This is a port of the Hmine algorithm in Python.
Some sample datasets are given:
- Market_Basket_Optimisation.txt
- Random_Test.txt
- Chess_data.txt
Any
.txt
dataset with items separated by delimiter (space)" "
can be used.
The Project_Main.py runs both the H_mine and Apriori algorithms for all three datasets and outputs the result into files.
-
Open Terminal(Mac) or Cmd(Windows).
-
Change your directory to the same directory where the program is stored.
Command: cd /path/to/program
-
Enter The Command:
python Project_Main.py
-
After Running, the Program will read all the 3 datasets one by one and run H-mine and Apriori with arbitrary value of minimum_support given in the file.
-
The output file is generated indicating the name of the dataset and the algorithm used. Confirmation of storage is given in the terminal with a prompt.
NOTE: Only 5 files are generated since the Apriori algorithm is not triggered for chess.txt.
Instruction: To Run algorithm H_Mine_Algo.py or Apriori_Algo.py Invidually.
NOTE: Python interactive shell is used to run the runHmine() or runApriori().
-
Open Terminal(Mac) or Cmd(Windows).
-
Change your directory to the same directory where the program is stored.
Command: cd /path/to/program Command: "python" (to enter python interactive shell) NOTE: use "pyhton3" for Bluenose
-
Enter The following Command in python interactive shell:
import Apriori_Algo
import H_Mine_Algo
Apriori_Algo() and H_Mine_Algo() takes 3 parameters:
- Input_file_name.txt
- Output_file_name.txt
- Relative support (Valid range 0<x<1)
For example,
Apriori_Algo.runApriori("Random_Test.txt","Random_Test_Out.txt",0.1)
H_Mine_Algo.runHmine("Random_Test.txt","Random_Test_Out.txt",0.1)
-
After Running, the program will read the input file and run the corresponding algorithm with the given minimum_support.
-
The output file is generated with the given name. If completed successfully, the Program will print a completion message.
Email: aman.jaiswal.dal.ca