-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapriori.py
More file actions
30 lines (21 loc) · 715 Bytes
/
apriori.py
File metadata and controls
30 lines (21 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
import time
from association_rules.frequent_itemset_mining import Apriori
if __name__ == '__main__':
if len(sys.argv) != 4:
print("Please use correct args!")
sys.exit()
input_file = sys.argv[1]
min_support_ratio = float(sys.argv[2])
output_file = sys.argv[3]
apriori = Apriori()
# Preprocess data
apriori.proccess_input_data(input_file)
print("[Apriori] Finding freq Itemset with min support >",
min_support_ratio, '--')
start_time = time.time()
apriori.find_supersets_k(min_support_ratio)
apriori.save_output(output_file)
end_time = time.time()
print("Elapsed time =", end_time-start_time)
print('----------\n')