def sd_apri_main(inFile,buckets_cls,minSupport, minConfidence,result_name): ''' ''' apri_logger.info("start sd_apri") #cfg_file_name = get_cfg_filename(BASE_DIR) get_cfg_filename(BASE_DIR) apri_indi_set = indicator_classify(inFile,buckets_cls) rows_file = apriori.dataFromList(apri_indi_set) items, rules = apriori.runApriori(rows_file, minSupport, minConfidence) result_dict = apriori.printResults(items, rules,result_name) return result_dict
# items, rules = apriori.runApriori(inFile, minSupport, minConfidence) # apriori.printResults(items, rules) # except Exception,e: # logging.error("apriori api error",e) # else: # logging.info("apriori api has execute successfully ") full_name = os.path.realpath(inFile) cfg_file_name = get_cfg_filename(full_name) pos = full_name.find(".txt") result_name = full_name[:pos] + "_result.txt" logging.info("start apriori!") try: #logging.info("in try!") #logging.info("inFile",str(inFile)) apri_indi_set = indicator_classify(inFile,buckets_cls) print "excute apriori algorithm" logging.info("excuting apriori!") rows_file = apriori.dataFromList(apri_indi_set) items, rules = apriori.runApriori(rows_file, minSupport, minConfidence) apriori.printResults(items, rules,result_name) except Exception,e: logging.error("apriori api error",str(e)) else: logging.info("apriori api has execute successfully ") print "End!!"
# ''' # try: # apri_indi_set = indicator_classify(inFile,buckets_cls) # inFile = apriori.dataFromList(apri_indi_set) # items, rules = apriori.runApriori(inFile, minSupport, minConfidence) # apriori.printResults(items, rules) # except Exception,e: # logging.error("apriori api error",e) # else: # logging.info("apriori api has execute successfully ") full_name = os.path.realpath(inFile) cfg_file_name = get_cfg_filename(full_name) pos = full_name.find(".txt") result_name = full_name[:pos] + "_result.txt" logging.info("start apriori!") try: #logging.info("in try!") #logging.info("inFile",str(inFile)) apri_indi_set = indicator_classify(inFile, buckets_cls) print "excute apriori algorithm" logging.info("excuting apriori!") rows_file = apriori.dataFromList(apri_indi_set) items, rules = apriori.runApriori(rows_file, minSupport, minConfidence) apriori.printResults(items, rules, result_name) except Exception, e: logging.error("apriori api error", str(e)) else: logging.info("apriori api has execute successfully ") print "End!!"