简体   繁体   English

TypeError: apriori() 得到了一个意外的关键字参数“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)

This is the tutorial about the apriori vs FP growth algorithm the problem here calculating minimum support in apriori I got this error.这是关于先验与 FP 增长算法的教程,这里的问题是在先验中计算最小支持我得到了这个错误。 how can I solve this?我该如何解决这个问题?

its just a typo.它只是一个错字。 you have typed mini instead of min while generating rules.您在生成规则时输入了 mini 而不是 min。 I have corrected it below我在下面更正了

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError:得到一个意外的关键字参数 - TypeError: got an unexpected keyword argument TypeError:open()获得了意外的关键字参数“缓冲” - TypeError: open() got an unexpected keyword argument 'buffering' TypeError:boxplot()得到一个意外的关键字参数'labels' - TypeError: boxplot() got an unexpected keyword argument 'labels' TypeError:randint()得到了意外的关键字参数“低” - TypeError: randint() got an unexpected keyword argument 'low' TypeError at '' __init__() 得到一个意外的关键字参数 '' - TypeError at '' __init__() got an unexpected keyword argument '' TypeError: violinplot() 得到了一个意外的关键字参数“分位数” - TypeError: violinplot() got an unexpected keyword argument 'quantiles' 类型错误:可配置()得到了一个意外的关键字参数“拒绝列表” - TypeError: configurable() got an unexpected keyword argument 'denylist' TypeError:train() 得到了一个意外的关键字参数“runs” - TypeError: train() got an unexpected keyword argument 'runs' TypeError: line() 得到了一个意外的关键字参数 'markers' - TypeError: line() got an unexpected keyword argument 'markers' 类型错误:Planet() 有一个意外的关键字参数“名称” - TypeError: Planet() got an unexpected keyword argument 'name'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM