TypeError: apriori() got an unexpected keyword argument 'mini_support'
TypeError: apriori() got an unexpected keyword argument 'mini_support'
def perform_rule_calculation(transact_items_matrix, rule_type="fpgrowth", min_support=0.001):
start_time = 0
total_execution = 0
if(not rule_type=="fpgrowth"):
start_time = time.time()
rule_items = apriori(transact_items_matrix,
mini_support=min_support,
use_colnames=True, low_memory=True)
total_execution = time.time() - start_time
print("Computed Apriori!")
n_range = range(1, 10, 1)
list_time_ap = []
list_time_fp = []
for n in n_range:
time_ap = 0
time_fp = 0
min_sup = float(n/100)
time_ap = perform_rule_calculation(trans_encoder_matrix, rule_type="fpgrowth", min_support=min_sup)
time_fp = perform_rule_calculation(trans_encoder_matrix, rule_type="aprior", min_support=min_sup)
list_time_ap.append(time_ap)
list_time_fp.append(time_fp)
这是关于 apriori 与 FP 增长算法的教程这里的问题是在 apriori 中计算最小支持我得到了这个错误。我该如何解决这个问题?
这只是一个错字。您在生成规则时键入了 mini 而不是 min。我已经在下面更正了
def perform_rule_calculation(transact_items_matrix, rule_type="fpgrowth", min_support=0.001):
start_time = 0
total_execution = 0
if(not rule_type=="fpgrowth"):
start_time = time.time()
rule_items = apriori(transact_items_matrix,
min_support=min_support,
use_colnames=True, low_memory=True)
total_execution = time.time() - start_time
print("Computed Apriori!")
n_range = range(1, 10, 1)
list_time_ap = []
list_time_fp = []
for n in n_range:
time_ap = 0
time_fp = 0
min_sup = float(n/100)
time_ap = perform_rule_calculation(trans_encoder_matrix, rule_type="fpgrowth", min_support=min_sup)
time_fp = perform_rule_calculation(trans_encoder_matrix, rule_type="aprior", min_support=min_sup)
list_time_ap.append(time_ap)
list_time_fp.append(time_fp)
def perform_rule_calculation(transact_items_matrix, rule_type="fpgrowth", min_support=0.001):
start_time = 0
total_execution = 0
if(not rule_type=="fpgrowth"):
start_time = time.time()
rule_items = apriori(transact_items_matrix,
mini_support=min_support,
use_colnames=True, low_memory=True)
total_execution = time.time() - start_time
print("Computed Apriori!")
n_range = range(1, 10, 1)
list_time_ap = []
list_time_fp = []
for n in n_range:
time_ap = 0
time_fp = 0
min_sup = float(n/100)
time_ap = perform_rule_calculation(trans_encoder_matrix, rule_type="fpgrowth", min_support=min_sup)
time_fp = perform_rule_calculation(trans_encoder_matrix, rule_type="aprior", min_support=min_sup)
list_time_ap.append(time_ap)
list_time_fp.append(time_fp)
这是关于 apriori 与 FP 增长算法的教程这里的问题是在 apriori 中计算最小支持我得到了这个错误。我该如何解决这个问题?
这只是一个错字。您在生成规则时键入了 mini 而不是 min。我已经在下面更正了
def perform_rule_calculation(transact_items_matrix, rule_type="fpgrowth", min_support=0.001):
start_time = 0
total_execution = 0
if(not rule_type=="fpgrowth"):
start_time = time.time()
rule_items = apriori(transact_items_matrix,
min_support=min_support,
use_colnames=True, low_memory=True)
total_execution = time.time() - start_time
print("Computed Apriori!")
n_range = range(1, 10, 1)
list_time_ap = []
list_time_fp = []
for n in n_range:
time_ap = 0
time_fp = 0
min_sup = float(n/100)
time_ap = perform_rule_calculation(trans_encoder_matrix, rule_type="fpgrowth", min_support=min_sup)
time_fp = perform_rule_calculation(trans_encoder_matrix, rule_type="aprior", min_support=min_sup)
list_time_ap.append(time_ap)
list_time_fp.append(time_fp)