本文主要是介绍《机器学习实战Machine_Learning_in_Action》 CH11-毒蘑菇判断 by Apriori算法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
寻找毒蘑菇
The first feature is poisonous or edible. If a sample is poisonous, you get a 1. If it’s edible,you get a 2.
导入数据
# apriori.py
import apriori# 加载数据
mushDatSet = [line.split() for line in open('mushroom.dat').readlines()]
计算支持度
L,suppData=apriori.apriori(mushDatSet, min_support=0.3)
计算关联规则
bigRuleList = apriori.generate_rules(L, suppData, 0.3)
# 导出2的特征
for i in range(len(bigRuleList)):if list(bigRuleList[i][1]) == ['2']:print(list(bigRuleList[i][0]),'--->',list(bigRuleList[i][1]),',几率为{:.0%}'.format(bigRuleList[i][2]))out:['23'] ---> ['2'] ,几率为82%
['34'] ---> ['2'] ,几率为51%
['36'] ---> ['2'] ,几率为44%
['59'] ---> ['2'] ,几率为70%
['63'] ---> ['2'] ,几率为69%
['67'] ---> ['2'] ,几率为62%
['76'] ---> ['2'] ,几率为62%
['85'] ---> ['2'] ,几率为52%
['86'] ---> ['2'] ,几率为51%
['90'] ---> ['2'] ,几率为49%
['93'] ---> ['2'] ,几率为79%
['39'] ---> ['2'] ,几率为70%
['28'] ---> ['2'] ,几率为97%
['53'] ---> ['2'] ,几率为56%
['23', '34'] ---> ['2'] ,几率为82%
['23', '36'] ---> ['2'] ,几率为81%
['23', '59'] ---> ['2'] ,几率为85%
['23', '63'] ---> ['2'] ,几率为84%
['23', '85'] ---> ['2'] ,几率为82%
['23', '86'] ---> ['2'] ,几率为82%
['23', '90'] ---> ['2'] ,几率为82%
['23', '93'] ---> ['2'] ,几率为80%
['34', '36'] ---> ['2'] ,几率为43%
['34', '59'] ---> ['2'] ,几率为69%
['34', '63'] ---> ['2'] ,几率为68%
['34', '67'] ---> ['2'] ,几率为62%
['34', '76'] ---> ['2'] ,几率为62%
['34', '85'] ---> ['2'] ,几率为51%
['34', '86'] ---> ['2'] ,几率为51%
['34', '90'] ---> ['2'] ,几率为48%
['34', '93'] ---> ['2'] ,几率为78%
['36', '59'] ---> ['2'] ,几率为68%
['36', '63'] ---> ['2'] ,几率为66%
['36', '85'] ---> ['2'] ,几率为44%
['86', '36'] ---> ['2'] ,几率为43%
['36', '90'] ---> ['2'] ,几率为43%
['36', '93'] ---> ['2'] ,几率为80%
['59', '63'] ---> ['2'] ,几率为75%
['59', '85'] ---> ['2'] ,几率为70%
['86', '59'] ---> ['2'] ,几率为69%
['90', '59'] ---> ['2'] ,几率为69%
['93', '59'] ---> ['2'] ,几率为82%
['63', '85'] ---> ['2'] ,几率为69%
['86', '63'] ---> ['2'] ,几率为68%
['90', '63'] ---> ['2'] ,几率为67%
['93', '63'] ---> ['2'] ,几率为81%
['67', '85'] ---> ['2'] ,几率为62%
['86', '67'] ---> ['2'] ,几率为62%
['85', '76'] ---> ['2'] ,几率为62%
['86', '76'] ---> ['2'] ,几率为62%
['86', '85'] ---> ['2'] ,几率为51%
['90', '85'] ---> ['2'] ,几率为49%
['93', '85'] ---> ['2'] ,几率为79%
['86', '90'] ---> ['2'] ,几率为48%
['86', '93'] ---> ['2'] ,几率为78%
['90', '93'] ---> ['2'] ,几率为79%
['23', '39'] ---> ['2'] ,几率为88%
['34', '39'] ---> ['2'] ,几率为69%
['36', '39'] ---> ['2'] ,几率为63%
['59', '39'] ---> ['2'] ,几率为94%
['63', '39'] ---> ['2'] ,几率为94%
['67', '39'] ---> ['2'] ,几率为87%
['39', '76'] ---> ['2'] ,几率为87%
['85', '39'] ---> ['2'] ,几率为70%
['86', '39'] ---> ['2'] ,几率为69%
['90', '39'] ---> ['2'] ,几率为68%
['93', '39'] ---> ['2'] ,几率为89%
['34', '28'] ---> ['2'] ,几率为96%
['34', '53'] ---> ['2'] ,几率为56%
['86', '28'] ---> ['2'] ,几率为97%
['86', '53'] ---> ['2'] ,几率为56%
['28', '59'] ---> ['2'] ,几率为97%
['28', '63'] ---> ['2'] ,几率为97%
['28', '85'] ---> ['2'] ,几率为97%
['53', '85'] ---> ['2'] ,几率为56%
['90', '28'] ---> ['2'] ,几率为98%
['90', '53'] ---> ['2'] ,几率为56%
['28', '39'] ---> ['2'] ,几率为98%
['53', '39'] ---> ['2'] ,几率为90%
['53', '28'] ---> ['2'] ,几率为100%
['34', '36', '23'] ---> ['2'] ,几率为81%
['34', '23', '59'] ---> ['2'] ,几率为85%
['34', '23', '63'] ---> ['2'] ,几率为84%
['34', '23', '85'] ---> ['2'] ,几率为82%
['86', '34', '23'] ---> ['2'] ,几率为82%
['34', '90', '23'] ---> ['2'] ,几率为82%
['34', '93', '23'] ---> ['2'] ,几率为80%
['23', '36', '59'] ---> ['2'] ,几率为85%
['23', '36', '63'] ---> ['2'] ,几率为84%
['23', '36', '85'] ---> ['2'] ,几率为81%
['86', '36', '23'] ---> ['2'] ,几率为81%
['23', '36', '93'] ---> ['2'] ,几率为80%
['23', '63', '59'] ---> ['2'] ,几率为86%
['23', '59', '85'] ---> ['2'] ,几率为85%
['86', '23', '59'] ---> ['2'] ,几率为85%
['23', '90', '59'] ---> ['2'] ,几率为86%
['23', '93', '59'] ---> ['2'] ,几率为84%
['23', '63', '85'] ---> ['2'] ,几率为84%
['86', '23', '63'] ---> ['2'] ,几率为84%
['86', '23', '85'] ---> ['2'] ,几率为82%
['23', '90', '85'] ---> ['2'] ,几率为82%
['23', '93', '85'] ---> ['2'] ,几率为80%
['86', '90', '23'] ---> ['2'] ,几率为82%
['86', '93', '23'] ---> ['2'] ,几率为80%
['23', '90', '93'] ---> ['2'] ,几率为82%
['34', '36', '59'] ---> ['2'] ,几率为66%
['34', '36', '63'] ---> ['2'] ,几率为64%
['34', '36', '85'] ---> ['2'] ,几率为43%
['86', '36', '34'] ---> ['2'] ,几率为43%
['34', '36', '90'] ---> ['2'] ,几率为41%
['34', '36', '93'] ---> ['2'] ,几率为78%
['34', '63', '59'] ---> ['2'] ,几率为74%
['34', '59', '85'] ---> ['2'] ,几率为69%
['86', '34', '59'] ---> ['2'] ,几率为69%
['34', '90', '59'] ---> ['2'] ,几率为68%
['34', '93', '59'] ---> ['2'] ,几率为81%
['34', '63', '85'] ---> ['2'] ,几率为68%
['86', '34', '63'] ---> ['2'] ,几率为68%
['34', '90', '63'] ---> ['2'] ,几率为66%
['34', '93', '63'] ---> ['2'] ,几率为80%
['34', '67', '85'] ---> ['2'] ,几率为62%
['86', '34', '67'] ---> ['2'] ,几率为62%
['34', '85', '76'] ---> ['2'] ,几率为62%
['86', '34', '76'] ---> ['2'] ,几率为62%
['86', '34', '85'] ---> ['2'] ,几率为51%
['34', '90', '85'] ---> ['2'] ,几率为48%
['34', '93', '85'] ---> ['2'] ,几率为78%
['86', '34', '90'] ---> ['2'] ,几率为48%
['86', '34', '93'] ---> ['2'] ,几率为78%
['34', '90', '93'] ---> ['2'] ,几率为78%
['36', '59', '63'] ---> ['2'] ,几率为75%
['36', '59', '85'] ---> ['2'] ,几率为68%
['36', '90', '59'] ---> ['2'] ,几率为67%
['36', '93', '59'] ---> ['2'] ,几率为83%
['36', '63', '85'] ---> ['2'] ,几率为66%
['36', '90', '63'] ---> ['2'] ,几率为65%
['36', '93', '63'] ---> ['2'] ,几率为82%
['36', '90', '85'] ---> ['2'] ,几率为43%
['36', '93', '85'] ---> ['2'] ,几率为80%
['86', '36', '59'] ---> ['2'] ,几率为66%
['86', '36', '63'] ---> ['2'] ,几率为64%
['86', '36', '85'] ---> ['2'] ,几率为43%
['86', '36', '90'] ---> ['2'] ,几率为41%
['86', '36', '93'] ---> ['2'] ,几率为78%
['36', '90', '93'] ---> ['2'] ,几率为81%
['63', '59', '85'] ---> ['2'] ,几率为75%
['86', '63', '59'] ---> ['2'] ,几率为74%
['86', '59', '85'] ---> ['2'] ,几率为69%
['86', '90', '59'] ---> ['2'] ,几率为68%
['86', '93', '59'] ---> ['2'] ,几率为81%
['63', '90', '59'] ---> ['2'] ,几率为75%
['90', '59', '85'] ---> ['2'] ,几率为69%
['90', '93', '59'] ---> ['2'] ,几率为82%
['63', '93', '59'] ---> ['2'] ,几率为82%
['93', '59', '85'] ---> ['2'] ,几率为82%
['86', '63', '85'] ---> ['2'] ,几率为68%
['86', '90', '63'] ---> ['2'] ,几率为66%
['86', '93', '63'] ---> ['2'] ,几率为80%
['90', '63', '85'] ---> ['2'] ,几率为67%
['90', '93', '63'] ---> ['2'] ,几率为81%
['93', '63', '85'] ---> ['2'] ,几率为81%
['86', '67', '85'] ---> ['2'] ,几率为62%
['86', '85', '76'] ---> ['2'] ,几率为62%
['86', '90', '85'] ---> ['2'] ,几率为48%
['86', '93', '85'] ---> ['2'] ,几率为78%
['90', '93', '85'] ---> ['2'] ,几率为79%
['86', '90', '93'] ---> ['2'] ,几率为78%
['34', '23', '39'] ---> ['2'] ,几率为88%
['23', '36', '39'] ---> ['2'] ,几率为88%
['23', '59', '39'] ---> ['2'] ,几率为92%
['23', '63', '39'] ---> ['2'] ,几率为92%
['23', '85', '39'] ---> ['2'] ,几率为88%
['86', '23', '39'] ---> ['2'] ,几率为88%
['23', '93', '39'] ---> ['2'] ,几率为87%
['34', '36', '39'] ---> ['2'] ,几率为61%
['34', '59', '39'] ---> ['2'] ,几率为94%
['34', '63', '39'] ---> ['2'] ,几率为93%
['34', '67', '39'] ---> ['2'] ,几率为87%
['34', '39', '76'] ---> ['2'] ,几率为87%
['34', '85', '39'] ---> ['2'] ,几率为69%
['86', '34', '39'] ---> ['2'] ,几率为69%
['34', '90', '39'] ---> ['2'] ,几率为67%
['34', '93', '39'] ---> ['2'] ,几率为88%
['36', '59', '39'] ---> ['2'] ,几率为93%
['36', '63', '39'] ---> ['2'] ,几率为92%
['36', '85', '39'] ---> ['2'] ,几率为63%
['86', '36', '39'] ---> ['2'] ,几率为61%
['36', '90', '39'] ---> ['2'] ,几率为62%
['36', '93', '39'] ---> ['2'] ,几率为88%
['63', '59', '39'] ---> ['2'] ,几率为95%
['39', '59', '85'] ---> ['2'] ,几率为94%
['86', '59', '39'] ---> ['2'] ,几率为94%
['90', '59', '39'] ---> ['2'] ,几率为95%
['93', '59', '39'] ---> ['2'] ,几率为93%
['63', '85', '39'] ---> ['2'] ,几率为94%
['86', '63', '39'] ---> ['2'] ,几率为93%
['90', '63', '39'] ---> ['2'] ,几率为95%
['93', '63', '39'] ---> ['2'] ,几率为92%
['39', '67', '85'] ---> ['2'] ,几率为87%
['86', '67', '39'] ---> ['2'] ,几率为87%
['85', '39', '76'] ---> ['2'] ,几率为87%
['86', '39', '76'] ---> ['2'] ,几率为87%
['86', '85', '39'] ---> ['2'] ,几率为69%
['90', '85', '39'] ---> ['2'] ,几率为68%
['93', '85', '39'] ---> ['2'] ,几率为89%
['86', '90', '39'] ---> ['2'] ,几率为67%
['86', '93', '39'] ---> ['2'] ,几率为88%
['90', '93', '39'] ---> ['2'] ,几率为90%
['34', '28', '59'] ---> ['2'] ,几率为97%
['34', '28', '63'] ---> ['2'] ,几率为97%
['34', '28', '85'] ---> ['2'] ,几率为96%
['34', '53', '85'] ---> ['2'] ,几率为56%
['86', '34', '28'] ---> ['2'] ,几率为97%
['86', '34', '53'] ---> ['2'] ,几率为56%
['34', '28', '90'] ---> ['2'] ,几率为98%
['34', '53', '90'] ---> ['2'] ,几率为56%
['86', '28', '59'] ---> ['2'] ,几率为97%
['86', '28', '63'] ---> ['2'] ,几率为97%
['86', '28', '85'] ---> ['2'] ,几率为97%
['86', '53', '85'] ---> ['2'] ,几率为56%
['86', '28', '90'] ---> ['2'] ,几率为99%
['86', '53', '90'] ---> ['2'] ,几率为56%
['34', '28', '39'] ---> ['2'] ,几率为98%
['34', '53', '39'] ---> ['2'] ,几率为90%
['34', '53', '28'] ---> ['2'] ,几率为100%
['86', '28', '39'] ---> ['2'] ,几率为98%
['86', '53', '39'] ---> ['2'] ,几率为90%
['86', '53', '28'] ---> ['2'] ,几率为100%
['63', '28', '59'] ---> ['2'] ,几率为97%
['28', '59', '85'] ---> ['2'] ,几率为97%
['90', '28', '59'] ---> ['2'] ,几率为100%
['28', '59', '39'] ---> ['2'] ,几率为97%
['28', '63', '85'] ---> ['2'] ,几率为97%
['28', '63', '39'] ---> ['2'] ,几率为97%
['90', '28', '85'] ---> ['2'] ,几率为98%
['28', '85', '39'] ---> ['2'] ,几率为98%
['90', '53', '85'] ---> ['2'] ,几率为56%
['53', '85', '39'] ---> ['2'] ,几率为90%
['28', '53', '85'] ---> ['2'] ,几率为100%
['28', '90', '39'] ---> ['2'] ,几率为100%
['53', '90', '39'] ---> ['2'] ,几率为90%
['53', '90', '28'] ---> ['2'] ,几率为100%
['28', '53', '39'] ---> ['2'] ,几率为100%
['86', '36', '23', '59'] ---> ['2'] ,几率为85%
['23', '36', '93', '59'] ---> ['2'] ,几率为84%
['86', '36', '93', '23'] ---> ['2'] ,几率为80%
['86', '93', '59', '23'] ---> ['2'] ,几率为84%
['86', '36', '59', '34'] ---> ['2'] ,几率为66%
['34', '36', '93', '59'] ---> ['2'] ,几率为82%
['86', '36', '93', '34'] ---> ['2'] ,几率为78%
['86', '34', '93', '59'] ---> ['2'] ,几率为81%
['36', '90', '93', '59'] ---> ['2'] ,几率为85%
['36', '93', '59', '63'] ---> ['2'] ,几率为84%
['36', '93', '59', '85'] ---> ['2'] ,几率为83%
['86', '36', '59', '63'] ---> ['2'] ,几率为73%
['86', '36', '59', '85'] ---> ['2'] ,几率为66%
['86', '36', '90', '59'] ---> ['2'] ,几率为65%
['86', '36', '93', '59'] ---> ['2'] ,几率为82%
['86', '36', '93', '85'] ---> ['2'] ,几率为78%
['86', '36', '90', '93'] ---> ['2'] ,几率为80%
['86', '90', '93', '59'] ---> ['2'] ,几率为81%
['86', '63', '93', '59'] ---> ['2'] ,几率为81%
['86', '93', '59', '85'] ---> ['2'] ,几率为81%
['34', '36', '23', '63'] ---> ['2'] ,几率为84%
['34', '36', '23', '85'] ---> ['2'] ,几率为81%
['34', '36', '23', '39'] ---> ['2'] ,几率为88%
['34', '63', '23', '59'] ---> ['2'] ,几率为86%
['34', '23', '59', '85'] ---> ['2'] ,几率为85%
['34', '90', '59', '23'] ---> ['2'] ,几率为86%
['34', '23', '59', '39'] ---> ['2'] ,几率为92%
['34', '23', '63', '85'] ---> ['2'] ,几率为84%
['34', '23', '63', '39'] ---> ['2'] ,几率为92%
['34', '90', '85', '23'] ---> ['2'] ,几率为82%
['34', '23', '85', '39'] ---> ['2'] ,几率为88%
['86', '34', '23', '63'] ---> ['2'] ,几率为84%
['86', '34', '23', '85'] ---> ['2'] ,几率为82%
['86', '34', '90', '23'] ---> ['2'] ,几率为82%
['86', '34', '23', '39'] ---> ['2'] ,几率为88%
['34', '93', '85', '23'] ---> ['2'] ,几率为80%
['34', '90', '93', '23'] ---> ['2'] ,几率为82%
['34', '93', '39', '23'] ---> ['2'] ,几率为87%
['34', '36', '23', '59'] ---> ['2'] ,几率为85%
['23', '36', '59', '63'] ---> ['2'] ,几率为86%
['23', '36', '59', '85'] ---> ['2'] ,几率为85%
['23', '36', '59', '39'] ---> ['2'] ,几率为92%
['23', '36', '63', '85'] ---> ['2'] ,几率为84%
['23', '36', '63', '39'] ---> ['2'] ,几率为92%
['23', '36', '85', '39'] ---> ['2'] ,几率为88%
['86', '36', '23', '34'] ---> ['2'] ,几率为81%
['86', '36', '23', '63'] ---> ['2'] ,几率为84%
['86', '36', '23', '85'] ---> ['2'] ,几率为81%
['86', '36', '23', '39'] ---> ['2'] ,几率为88%
['34', '36', '93', '23'] ---> ['2'] ,几率为80%
['23', '36', '93', '85'] ---> ['2'] ,几率为80%
['23', '36', '93', '39'] ---> ['2'] ,几率为87%
['23', '63', '59', '85'] ---> ['2'] ,几率为86%
['23', '63', '59', '39'] ---> ['2'] ,几率为94%
['23', '90', '59', '85'] ---> ['2'] ,几率为86%
['23', '85', '59', '39'] ---> ['2'] ,几率为92%
['86', '34', '23', '59'] ---> ['2'] ,几率为85%
['86', '63', '23', '59'] ---> ['2'] ,几率为86%
['86', '23', '59', '85'] ---> ['2'] ,几率为85%
['86', '90', '23', '59'] ---> ['2'] ,几率为86%
['86', '23', '59', '39'] ---> ['2'] ,几率为92%
['34', '93', '59', '23'] ---> ['2'] ,几率为84%
['23', '90', '93', '59'] ---> ['2'] ,几率为86%
['23', '93', '59', '85'] ---> ['2'] ,几率为84%
['23', '93', '59', '39'] ---> ['2'] ,几率为92%
['23', '85', '63', '39'] ---> ['2'] ,几率为92%
['86', '23', '63', '85'] ---> ['2'] ,几率为84%
['86', '23', '63', '39'] ---> ['2'] ,几率为92%
['86', '90', '23', '85'] ---> ['2'] ,几率为82%
['86', '23', '85', '39'] ---> ['2'] ,几率为88%
['23', '90', '93', '85'] ---> ['2'] ,几率为82%
['23', '93', '85', '39'] ---> ['2'] ,几率为87%
['86', '34', '93', '23'] ---> ['2'] ,几率为80%
['86', '93', '85', '23'] ---> ['2'] ,几率为80%
['86', '90', '93', '23'] ---> ['2'] ,几率为82%
['86', '93', '39', '23'] ---> ['2'] ,几率为87%
['34', '36', '59', '63'] ---> ['2'] ,几率为73%
['34', '36', '59', '85'] ---> ['2'] ,几率为66%
['34', '36', '90', '59'] ---> ['2'] ,几率为65%
['34', '36', '59', '39'] ---> ['2'] ,几率为92%
['34', '36', '63', '85'] ---> ['2'] ,几率为64%
['34', '36', '63', '39'] ---> ['2'] ,几率为92%
['34', '36', '90', '85'] ---> ['2'] ,几率为41%
['34', '36', '85', '39'] ---> ['2'] ,几率为61%
['86', '36', '63', '34'] ---> ['2'] ,几率为64%
['86', '36', '85', '34'] ---> ['2'] ,几率为43%
['86', '36', '90', '34'] ---> ['2'] ,几率为41%
['86', '36', '39', '34'] ---> ['2'] ,几率为61%
['34', '36', '93', '85'] ---> ['2'] ,几率为78%
['34', '36', '90', '93'] ---> ['2'] ,几率为80%
['34', '36', '93', '39'] ---> ['2'] ,几率为87%
['34', '63', '59', '85'] ---> ['2'] ,几率为74%
['34', '63', '90', '59'] ---> ['2'] ,几率为73%
['34', '63', '59', '39'] ---> ['2'] ,几率为95%
['34', '90', '59', '85'] ---> ['2'] ,几率为68%
['34', '85', '59', '39'] ---> ['2'] ,几率为94%
['86', '34', '59', '63'] ---> ['2'] ,几率为74%
['86', '34', '59', '85'] ---> ['2'] ,几率为69%
['86', '34', '90', '59'] ---> ['2'] ,几率为68%
['86', '34', '59', '39'] ---> ['2'] ,几率为94%
['34', '90', '59', '39'] ---> ['2'] ,几率为95%
['34', '90', '93', '59'] ---> ['2'] ,几率为81%
['34', '63', '93', '59'] ---> ['2'] ,几率为81%
['34', '93', '59', '85'] ---> ['2'] ,几率为81%
['34', '93', '59', '39'] ---> ['2'] ,几率为92%
['34', '85', '63', '39'] ---> ['2'] ,几率为93%
['86', '34', '63', '85'] ---> ['2'] ,几率为68%
['86', '34', '90', '63'] ---> ['2'] ,几率为66%
['86', '34', '63', '39'] ---> ['2'] ,几率为93%
['34', '90', '63', '85'] ---> ['2'] ,几率为66%
['34', '90', '63', '39'] ---> ['2'] ,几率为95%
['34', '93', '63', '85'] ---> ['2'] ,几率为80%
['34', '85', '67', '39'] ---> ['2'] ,几率为87%
['86', '34', '67', '85'] ---> ['2'] ,几率为62%
['86', '34', '67', '39'] ---> ['2'] ,几率为87%
['34', '85', '39', '76'] ---> ['2'] ,几率为87%
['86', '34', '85', '76'] ---> ['2'] ,几率为62%
['86', '34', '39', '76'] ---> ['2'] ,几率为87%
['86', '34', '90', '85'] ---> ['2'] ,几率为48%
['86', '34', '85', '39'] ---> ['2'] ,几率为69%
['34', '90', '85', '39'] ---> ['2'] ,几率为67%
['34', '90', '93', '85'] ---> ['2'] ,几率为78%
['34', '93', '85', '39'] ---> ['2'] ,几率为88%
['86', '34', '90', '39'] ---> ['2'] ,几率为67%
['86', '34', '93', '63'] ---> ['2'] ,几率为80%
['86', '34', '93', '85'] ---> ['2'] ,几率为78%
['86', '34', '90', '93'] ---> ['2'] ,几率为78%
['86', '34', '93', '39'] ---> ['2'] ,几率为88%
['36', '59', '85', '63'] ---> ['2'] ,几率为75%
['36', '90', '59', '63'] ---> ['2'] ,几率为75%
['36', '59', '39', '63'] ---> ['2'] ,几率为95%
['36', '90', '59', '85'] ---> ['2'] ,几率为67%
['36', '85', '59', '39'] ---> ['2'] ,几率为93%
['36', '90', '59', '39'] ---> ['2'] ,几率为95%
['36', '93', '59', '39'] ---> ['2'] ,几率为92%
['36', '85', '63', '39'] ---> ['2'] ,几率为92%
['36', '90', '63', '85'] ---> ['2'] ,几率为65%
['36', '93', '63', '85'] ---> ['2'] ,几率为82%
['36', '90', '93', '63'] ---> ['2'] ,几率为84%
['36', '93', '63', '39'] ---> ['2'] ,几率为92%
['36', '90', '85', '39'] ---> ['2'] ,几率为62%
['36', '90', '93', '85'] ---> ['2'] ,几率为81%
['36', '93', '85', '39'] ---> ['2'] ,几率为88%
['86', '36', '59', '39'] ---> ['2'] ,几率为92%
['86', '36', '63', '85'] ---> ['2'] ,几率为64%
['86', '36', '63', '39'] ---> ['2'] ,几率为92%
['86', '36', '90', '85'] ---> ['2'] ,几率为41%
['86', '36', '85', '39'] ---> ['2'] ,几率为61%
['86', '36', '93', '39'] ---> ['2'] ,几率为87%
['36', '90', '93', '39'] ---> ['2'] ,几率为90%
['63', '85', '59', '39'] ---> ['2'] ,几率为95%
['86', '63', '59', '85'] ---> ['2'] ,几率为74%
['86', '63', '90', '59'] ---> ['2'] ,几率为73%
['86', '63', '59', '39'] ---> ['2'] ,几率为95%
['86', '90', '59', '85'] ---> ['2'] ,几率为68%
['86', '85', '59', '39'] ---> ['2'] ,几率为94%
['86', '90', '59', '39'] ---> ['2'] ,几率为95%
['86', '93', '59', '39'] ---> ['2'] ,几率为92%
['63', '90', '59', '85'] ---> ['2'] ,几率为75%
['63', '90', '59', '39'] ---> ['2'] ,几率为97%
['85', '90', '59', '39'] ---> ['2'] ,几率为95%
['63', '90', '93', '59'] ---> ['2'] ,几率为83%
['90', '93', '59', '85'] ---> ['2'] ,几率为82%
['90', '93', '59', '39'] ---> ['2'] ,几率为95%
['63', '93', '59', '85'] ---> ['2'] ,几率为82%
['63', '93', '59', '39'] ---> ['2'] ,几率为95%
['85', '93', '59', '39'] ---> ['2'] ,几率为93%
['86', '85', '63', '39'] ---> ['2'] ,几率为93%
['86', '90', '63', '85'] ---> ['2'] ,几率为66%
['86', '90', '63', '39'] ---> ['2'] ,几率为95%
['86', '93', '63', '85'] ---> ['2'] ,几率为80%
['85', '90', '63', '39'] ---> ['2'] ,几率为95%
['90', '93', '63', '85'] ---> ['2'] ,几率为81%
['85', '93', '63', '39'] ---> ['2'] ,几率为92%
['86', '85', '67', '39'] ---> ['2'] ,几率为87%
['86', '85', '39', '76'] ---> ['2'] ,几率为87%
['86', '90', '85', '39'] ---> ['2'] ,几率为67%
['86', '90', '93', '85'] ---> ['2'] ,几率为78%
['86', '93', '85', '39'] ---> ['2'] ,几率为88%
['90', '93', '85', '39'] ---> ['2'] ,几率为90%
['34', '28', '59', '85'] ---> ['2'] ,几率为97%
['86', '34', '28', '59'] ---> ['2'] ,几率为97%
['86', '34', '28', '63'] ---> ['2'] ,几率为97%
['86', '34', '28', '85'] ---> ['2'] ,几率为97%
['86', '34', '53', '85'] ---> ['2'] ,几率为56%
['34', '90', '28', '85'] ---> ['2'] ,几率为98%
['34', '90', '53', '85'] ---> ['2'] ,几率为56%
['86', '34', '90', '28'] ---> ['2'] ,几率为99%
['86', '34', '90', '53'] ---> ['2'] ,几率为56%
['86', '28', '59', '85'] ---> ['2'] ,几率为97%
['86', '90', '28', '85'] ---> ['2'] ,几率为99%
['86', '90', '53', '85'] ---> ['2'] ,几率为56%
['34', '28', '59', '39'] ---> ['2'] ,几率为97%
['86', '34', '28', '39'] ---> ['2'] ,几率为98%
['86', '34', '53', '39'] ---> ['2'] ,几率为90%
['34', '90', '28', '39'] ---> ['2'] ,几率为100%
['34', '90', '53', '39'] ---> ['2'] ,几率为90%['86', '28', '59', '39'] ---> ['2'] ,几率为97%
['86', '90', '28', '39'] ---> ['2'] ,几率为100%
['86', '90', '53', '39'] ---> ['2'] ,几率为90%
['34', '28', '63', '85'] ---> ['2'] ,几率为97%
['34', '28', '63', '39'] ---> ['2'] ,几率为97%
['34', '28', '85', '39'] ---> ['2'] ,几率为98%
['34', '53', '28', '85'] ---> ['2'] ,几率为100%
['34', '53', '85', '39'] ---> ['2'] ,几率为90%
['86', '34', '53', '28'] ---> ['2'] ,几率为100%
['34', '90', '53', '28'] ---> ['2'] ,几率为100%
['86', '28', '63', '85'] ---> ['2'] ,几率为97%
['86', '28', '63', '39'] ---> ['2'] ,几率为97%
['86', '28', '85', '39'] ---> ['2'] ,几率为98%
['86', '53', '28', '85'] ---> ['2'] ,几率为100%
['86', '53', '85', '39'] ---> ['2'] ,几率为90%
['86', '90', '53', '28'] ---> ['2'] ,几率为100%
['34', '53', '28', '39'] ---> ['2'] ,几率为100%
['86', '53', '28', '39'] ---> ['2'] ,几率为100%
['63', '28', '59', '85'] ---> ['2'] ,几率为97%
['90', '28', '59', '85'] ---> ['2'] ,几率为100%
['85', '28', '59', '39'] ---> ['2'] ,几率为97%
['85', '28', '63', '39'] ---> ['2'] ,几率为97%
['90', '28', '85', '39'] ---> ['2'] ,几率为100%
['90', '53', '28', '85'] ---> ['2'] ,几率为100%
['90', '53', '85', '39'] ---> ['2'] ,几率为90%
['53', '28', '85', '39'] ---> ['2'] ,几率为100%
['90', '53', '28', '39'] ---> ['2'] ,几率为100%
['86', '36', '93', '59', '23'] ---> ['2'] ,几率为84%
['86', '36', '93', '59', '34'] ---> ['2'] ,几率为82%
['86', '36', '93', '59', '85'] ---> ['2'] ,几率为82%
['86', '36', '93', '59', '90'] ---> ['2'] ,几率为84%
['86', '36', '34', '59', '23'] ---> ['2'] ,几率为85%
['86', '36', '59', '23', '63'] ---> ['2'] ,几率为86%
['86', '36', '59', '23', '85'] ---> ['2'] ,几率为85%
['86', '36', '39', '59', '23'] ---> ['2'] ,几率为92%
['36', '93', '59', '34', '23'] ---> ['2'] ,几率为84%
['36', '93', '59', '23', '85'] ---> ['2'] ,几率为84%
['36', '93', '39', '59', '23'] ---> ['2'] ,几率为92%
['86', '36', '93', '34', '23'] ---> ['2'] ,几率为80%
['86', '36', '93', '23', '85'] ---> ['2'] ,几率为80%
['86', '36', '93', '39', '23'] ---> ['2'] ,几率为87%
['86', '93', '59', '34', '23'] ---> ['2'] ,几率为84%
['86', '93', '59', '23', '90'] ---> ['2'] ,几率为86%
['86', '93', '59', '23', '85'] ---> ['2'] ,几率为84%
['86', '93', '39', '59', '23'] ---> ['2'] ,几率为92%
['86', '36', '59', '34', '63'] ---> ['2'] ,几率为73%
['86', '36', '59', '34', '85'] ---> ['2'] ,几率为66%
['86', '36', '59', '34', '90'] ---> ['2'] ,几率为65%
['86', '36', '39', '59', '34'] ---> ['2'] ,几率为92%
['36', '93', '59', '34', '90'] ---> ['2'] ,几率为84%
['36', '93', '59', '34', '85'] ---> ['2'] ,几率为82%
['36', '93', '39', '59', '34'] ---> ['2'] ,几率为92%
['86', '36', '93', '34', '85'] ---> ['2'] ,几率为78%
['86', '36', '93', '34', '90'] ---> ['2'] ,几率为80%
['86', '36', '93', '39', '34'] ---> ['2'] ,几率为87%
['86', '93', '59', '34', '90'] ---> ['2'] ,几率为81%
['86', '93', '59', '34', '63'] ---> ['2'] ,几率为81%
['86', '93', '59', '34', '85'] ---> ['2'] ,几率为81%
['86', '93', '39', '59', '34'] ---> ['2'] ,几率为92%
['36', '93', '59', '90', '63'] ---> ['2'] ,几率为86%
['36', '93', '59', '90', '85'] ---> ['2'] ,几率为85%
['36', '93', '39', '59', '90'] ---> ['2'] ,几率为95%
['36', '93', '63', '59', '85'] ---> ['2'] ,几率为84%
['36', '93', '39', '59', '63'] ---> ['2'] ,几率为94%
['36', '93', '39', '59', '85'] ---> ['2'] ,几率为92%
['86', '36', '63', '59', '85'] ---> ['2'] ,几率为73%
['86', '36', '39', '59', '63'] ---> ['2'] ,几率为94%
['86', '36', '59', '90', '85'] ---> ['2'] ,几率为65%
['86', '36', '39', '59', '85'] ---> ['2'] ,几率为92%
['86', '36', '93', '39', '59'] ---> ['2'] ,几率为92%
['86', '36', '93', '90', '85'] ---> ['2'] ,几率为80%
['86', '36', '93', '39', '85'] ---> ['2'] ,几率为87%
['86', '93', '59', '90', '85'] ---> ['2'] ,几率为81%
['86', '93', '59', '63', '85'] ---> ['2'] ,几率为81%
['86', '93', '39', '59', '85'] ---> ['2'] ,几率为92%
['36', '34', '23', '63', '85'] ---> ['2'] ,几率为84%
['36', '39', '34', '23', '63'] ---> ['2'] ,几率为92%
['36', '39', '34', '23', '85'] ---> ['2'] ,几率为88%
['59', '34', '23', '63', '85'] ---> ['2'] ,几率为86%
['23', '59', '34', '90', '85'] ---> ['2'] ,几率为86%
['39', '59', '34', '23', '63'] ---> ['2'] ,几率为94%
['39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['39', '63', '34', '23', '85'] ---> ['2'] ,几率为92%
['86', '34', '23', '63', '85'] ---> ['2'] ,几率为84%
['86', '23', '34', '90', '85'] ---> ['2'] ,几率为82%
['86', '39', '34', '23', '63'] ---> ['2'] ,几率为92%
['86', '39', '34', '23', '85'] ---> ['2'] ,几率为88%
['93', '23', '34', '90', '85'] ---> ['2'] ,几率为82%
['93', '39', '34', '23', '85'] ---> ['2'] ,几率为87%
['36', '59', '34', '23', '63'] ---> ['2'] ,几率为86%
['36', '59', '34', '23', '85'] ---> ['2'] ,几率为85%
['36', '63', '59', '23', '85'] ---> ['2'] ,几率为86%
['36', '39', '59', '34', '23'] ---> ['2'] ,几率为92%
['36', '39', '59', '23', '63'] ---> ['2'] ,几率为94%
['36', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['36', '39', '63', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '34', '23', '63'] ---> ['2'] ,几率为84%
['86', '36', '34', '23', '85'] ---> ['2'] ,几率为81%
['86', '36', '23', '63', '85'] ---> ['2'] ,几率为84%
['86', '36', '34', '39', '23'] ---> ['2'] ,几率为88%
['86', '36', '39', '23', '63'] ---> ['2'] ,几率为92%
['86', '36', '39', '23', '85'] ---> ['2'] ,几率为88%
['36', '93', '34', '23', '85'] ---> ['2'] ,几率为80%
['36', '93', '39', '34', '23'] ---> ['2'] ,几率为87%
['36', '93', '39', '23', '85'] ---> ['2'] ,几率为87%
['39', '59', '23', '63', '85'] ---> ['2'] ,几率为94%
['86', '59', '34', '23', '63'] ---> ['2'] ,几率为86%
['86', '59', '34', '23', '85'] ---> ['2'] ,几率为85%
['86', '23', '59', '34', '90'] ---> ['2'] ,几率为86%
['86', '59', '23', '63', '85'] ---> ['2'] ,几率为86%
['86', '59', '23', '90', '85'] ---> ['2'] ,几率为86%
['86', '39', '59', '34', '23'] ---> ['2'] ,几率为92%
['86', '39', '59', '23', '63'] ---> ['2'] ,几率为94%
['86', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['93', '23', '59', '34', '90'] ---> ['2'] ,几率为86%
['93', '59', '34', '23', '85'] ---> ['2'] ,几率为84%
['93', '59', '23', '90', '85'] ---> ['2'] ,几率为86%
['93', '39', '59', '34', '23'] ---> ['2'] ,几率为92%
['93', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['86', '39', '63', '23', '85'] ---> ['2'] ,几率为92%
['86', '93', '34', '23', '85'] ---> ['2'] ,几率为80%
['86', '93', '23', '34', '90'] ---> ['2'] ,几率为82%
['86', '93', '23', '90', '85'] ---> ['2'] ,几率为82%
['86', '93', '39', '34', '23'] ---> ['2'] ,几率为87%
['86', '93', '39', '23', '85'] ---> ['2'] ,几率为87%
['36', '63', '59', '34', '85'] ---> ['2'] ,几率为73%
['36', '59', '34', '90', '85'] ---> ['2'] ,几率为65%
['36', '39', '59', '34', '63'] ---> ['2'] ,几率为94%
['36', '39', '59', '34', '85'] ---> ['2'] ,几率为92%
['36', '39', '63', '34', '85'] ---> ['2'] ,几率为92%
['86', '36', '34', '63', '85'] ---> ['2'] ,几率为64%
['86', '36', '34', '90', '85'] ---> ['2'] ,几率为41%
['86', '36', '39', '34', '63'] ---> ['2'] ,几率为92%
['86', '36', '39', '34', '85'] ---> ['2'] ,几率为61%
['36', '93', '34', '90', '85'] ---> ['2'] ,几率为80%
['36', '93', '39', '34', '85'] ---> ['2'] ,几率为87%
['59', '34', '90', '63', '85'] ---> ['2'] ,几率为73%
['39', '59', '34', '63', '85'] ---> ['2'] ,几率为95%
['39', '59', '34', '90', '85'] ---> ['2'] ,几率为95%
['86', '63', '59', '34', '85'] ---> ['2'] ,几率为74%
['86', '59', '34', '90', '63'] ---> ['2'] ,几率为73%
['86', '59', '34', '90', '85'] ---> ['2'] ,几率为68%
['86', '39', '59', '34', '63'] ---> ['2'] ,几率为95%
['86', '39', '59', '34', '85'] ---> ['2'] ,几率为94%
['86', '39', '59', '34', '90'] ---> ['2'] ,几率为95%
['93', '59', '34', '90', '85'] ---> ['2'] ,几率为81%
['93', '59', '34', '63', '85'] ---> ['2'] ,几率为81%
['93', '39', '59', '34', '85'] ---> ['2'] ,几率为92%
['86', '34', '90', '63', '85'] ---> ['2'] ,几率为66%
['86', '39', '63', '34', '85'] ---> ['2'] ,几率为93%
['86', '39', '34', '90', '63'] ---> ['2'] ,几率为95%
['39', '63', '34', '90', '85'] ---> ['2'] ,几率为95%
['86', '39', '67', '34', '85'] ---> ['2'] ,几率为87%
['86', '39', '76', '34', '85'] ---> ['2'] ,几率为87%
['86', '39', '34', '90', '85'] ---> ['2'] ,几率为67%
['86', '93', '34', '63', '85'] ---> ['2'] ,几率为80%
['86', '93', '34', '90', '85'] ---> ['2'] ,几率为78%
['86', '93', '39', '34', '85'] ---> ['2'] ,几率为88%
['36', '63', '59', '90', '85'] ---> ['2'] ,几率为75%
['36', '39', '63', '59', '85'] ---> ['2'] ,几率为95%
['36', '39', '59', '90', '85'] ---> ['2'] ,几率为95%
['36', '93', '90', '63', '85'] ---> ['2'] ,几率为84%
['36', '93', '39', '63', '85'] ---> ['2'] ,几率为92%
['36', '93', '39', '90', '85'] ---> ['2'] ,几率为90%
['86', '36', '39', '63', '85'] ---> ['2'] ,几率为92%
['86', '59', '90', '63', '85'] ---> ['2'] ,几率为73%
['86', '39', '59', '63', '85'] ---> ['2'] ,几率为95%
['86', '39', '59', '90', '85'] ---> ['2'] ,几率为95%
['39', '63', '59', '90', '85'] ---> ['2'] ,几率为97%
['93', '59', '90', '63', '85'] ---> ['2'] ,几率为83%
['93', '39', '59', '90', '85'] ---> ['2'] ,几率为95%
['93', '39', '63', '59', '85'] ---> ['2'] ,几率为95%
['86', '39', '63', '90', '85'] ---> ['2'] ,几率为95%
['86', '28', '59', '34', '85'] ---> ['2'] ,几率为97%
['86', '28', '39', '59', '34'] ---> ['2'] ,几率为97%
['86', '28', '34', '63', '85'] ---> ['2'] ,几率为97%
['86', '28', '34', '90', '85'] ---> ['2'] ,几率为99%
['86', '53', '34', '90', '85'] ---> ['2'] ,几率为56%
['28', '39', '59', '34', '85'] ---> ['2'] ,几率为97%
['86', '28', '39', '34', '90'] ---> ['2'] ,几率为100%
['86', '28', '39', '34', '63'] ---> ['2'] ,几率为97%
['86', '28', '39', '34', '85'] ---> ['2'] ,几率为98%
['86', '53', '39', '34', '90'] ---> ['2'] ,几率为90%
['86', '53', '39', '34', '85'] ---> ['2'] ,几率为90%
['28', '39', '34', '90', '85'] ---> ['2'] ,几率为100%
['53', '39', '34', '90', '85'] ---> ['2'] ,几率为90%
['86', '28', '39', '59', '85'] ---> ['2'] ,几率为97%
['86', '28', '39', '90', '85'] ---> ['2'] ,几率为100%
['86', '53', '39', '90', '85'] ---> ['2'] ,几率为90%
['28', '39', '63', '34', '85'] ---> ['2'] ,几率为97%
['28', '53', '34', '90', '85'] ---> ['2'] ,几率为100%
['86', '28', '53', '34', '85'] ---> ['2'] ,几率为100%
['86', '28', '53', '34', '90'] ---> ['2'] ,几率为100%
['86', '28', '53', '39', '34'] ---> ['2'] ,几率为100%
['86', '28', '39', '63', '85'] ---> ['2'] ,几率为97%
['86', '28', '53', '90', '85'] ---> ['2'] ,几率为100%
['86', '53', '28', '39', '85'] ---> ['2'] ,几率为100%
['86', '28', '53', '39', '90'] ---> ['2'] ,几率为100%
['28', '53', '39', '34', '85'] ---> ['2'] ,几率为100%
['28', '53', '39', '34', '90'] ---> ['2'] ,几率为100%
['28', '53', '39', '90', '85'] ---> ['2'] ,几率为100%
['86', '36', '93', '59', '34', '23'] ---> ['2'] ,几率为84%
['86', '36', '93', '59', '23', '85'] ---> ['2'] ,几率为84%
['86', '36', '93', '59', '34', '85'] ---> ['2'] ,几率为82%
['86', '36', '93', '59', '34', '90'] ---> ['2'] ,几率为84%
['86', '36', '93', '59', '90', '85'] ---> ['2'] ,几率为84%
['86', '36', '34', '59', '23', '63'] ---> ['2'] ,几率为86%
['86', '36', '34', '59', '23', '85'] ---> ['2'] ,几率为85%
['86', '36', '59', '23', '63', '85'] ---> ['2'] ,几率为86%
['86', '36', '39', '59', '34', '23'] ---> ['2'] ,几率为92%
['86', '36', '39', '59', '23', '63'] ---> ['2'] ,几率为94%
['86', '36', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['36', '93', '59', '34', '23', '85'] ---> ['2'] ,几率为84%
['36', '93', '39', '59', '34', '23'] ---> ['2'] ,几率为92%
['36', '93', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '93', '34', '23', '85'] ---> ['2'] ,几率为80%
['86', '36', '93', '39', '59', '23'] ---> ['2'] ,几率为92%
['86', '36', '93', '39', '34', '23'] ---> ['2'] ,几率为87%
['86', '36', '93', '39', '23', '85'] ---> ['2'] ,几率为87%
['86', '93', '23', '59', '34', '90'] ---> ['2'] ,几率为86%
['86', '93', '59', '34', '23', '85'] ---> ['2'] ,几率为84%
['86', '93', '59', '23', '90', '85'] ---> ['2'] ,几率为86%
['86', '93', '39', '59', '34', '23'] ---> ['2'] ,几率为92%
['86', '93', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '59', '34', '63', '85'] ---> ['2'] ,几率为73%
['86', '36', '59', '34', '90', '85'] ---> ['2'] ,几率为65%
['86', '36', '39', '59', '34', '63'] ---> ['2'] ,几率为94%
['86', '36', '39', '59', '34', '85'] ---> ['2'] ,几率为92%
['36', '93', '59', '34', '90', '85'] ---> ['2'] ,几率为84%
['36', '93', '39', '59', '34', '85'] ---> ['2'] ,几率为92%
['86', '36', '93', '34', '90', '85'] ---> ['2'] ,几率为80%
['86', '36', '93', '39', '59', '34'] ---> ['2'] ,几率为92%
['86', '36', '93', '39', '34', '85'] ---> ['2'] ,几率为87%
['86', '93', '59', '34', '90', '85'] ---> ['2'] ,几率为81%
['86', '93', '59', '34', '63', '85'] ---> ['2'] ,几率为81%
['86', '93', '39', '59', '34', '85'] ---> ['2'] ,几率为92%
['36', '93', '59', '90', '63', '85'] ---> ['2'] ,几率为86%
['36', '93', '39', '59', '90', '85'] ---> ['2'] ,几率为95%
['36', '93', '39', '59', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '39', '59', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '93', '39', '59', '85'] ---> ['2'] ,几率为92%
['36', '39', '34', '23', '63', '85'] ---> ['2'] ,几率为92%
['39', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为94%
['86', '39', '34', '23', '63', '85'] ---> ['2'] ,几率为92%
['36', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为86%
['36', '39', '59', '34', '23', '63'] ---> ['2'] ,几率为94%
['36', '39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['36', '39', '59', '23', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '34', '23', '63', '85'] ---> ['2'] ,几率为84%
['86', '36', '34', '39', '23', '63'] ---> ['2'] ,几率为92%
['86', '36', '34', '39', '23', '85'] ---> ['2'] ,几率为88%
['86', '36', '39', '23', '63', '85'] ---> ['2'] ,几率为92%
['36', '93', '39', '34', '23', '85'] ---> ['2'] ,几率为87%
['86', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为86%
['86', '23', '59', '34', '90', '85'] ---> ['2'] ,几率为86%
['86', '39', '59', '34', '23', '63'] ---> ['2'] ,几率为94%
['86', '39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['86', '39', '59', '23', '63', '85'] ---> ['2'] ,几率为94%
['93', '23', '59', '34', '90', '85'] ---> ['2'] ,几率为86%
['93', '39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['86', '93', '23', '34', '90', '85'] ---> ['2'] ,几率为82%
['86', '93', '39', '34', '23', '85'] ---> ['2'] ,几率为87%
['36', '39', '59', '34', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '39', '34', '63', '85'] ---> ['2'] ,几率为92%
['86', '59', '34', '90', '63', '85'] ---> ['2'] ,几率为73%
['86', '39', '59', '34', '63', '85'] ---> ['2'] ,几率为95%
['86', '39', '59', '34', '90', '85'] ---> ['2'] ,几率为95%
['86', '39', '34', '90', '63', '85'] ---> ['2'] ,几率为95%
['86', '28', '39', '59', '34', '85'] ---> ['2'] ,几率为97%
['86', '28', '39', '34', '90', '85'] ---> ['2'] ,几率为100%
['86', '28', '39', '34', '63', '85'] ---> ['2'] ,几率为97%
['86', '53', '39', '34', '90', '85'] ---> ['2'] ,几率为90%
['86', '53', '28', '34', '90', '85'] ---> ['2'] ,几率为100%
['86', '53', '28', '39', '34', '85'] ---> ['2'] ,几率为100%
['86', '53', '28', '39', '34', '90'] ---> ['2'] ,几率为100%
['86', '28', '53', '39', '90', '85'] ---> ['2'] ,几率为100%
['53', '28', '39', '34', '90', '85'] ---> ['2'] ,几率为100%
['86', '36', '93', '59', '34', '23', '85'] ---> ['2'] ,几率为84%
['86', '36', '93', '59', '34', '90', '85'] ---> ['2'] ,几率为84%
['86', '36', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为86%
['86', '36', '39', '59', '34', '23', '63'] ---> ['2'] ,几率为94%
['86', '36', '39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '39', '59', '23', '63', '85'] ---> ['2'] ,几率为94%
['36', '93', '39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '93', '34', '39', '59', '23'] ---> ['2'] ,几率为92%
['86', '36', '93', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '93', '39', '34', '23', '85'] ---> ['2'] ,几率为87%
['86', '93', '34', '59', '23', '90', '85'] ---> ['2'] ,几率为86%
['86', '93', '39', '59', '34', '23', '85'] ---> ['2'] ,几率为92%
['86', '36', '39', '59', '34', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '93', '39', '59', '34', '85'] ---> ['2'] ,几率为92%
['36', '39', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '39', '34', '23', '63', '85'] ---> ['2'] ,几率为92%
['86', '39', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为94%
['86', '53', '28', '39', '34', '90', '85'] ---> ['2'] ,几率为100%
['86', '36', '39', '59', '34', '23', '63', '85'] ---> ['2'] ,几率为94%
['86', '36', '93', '34', '39', '59', '23', '85'] ---> ['2'] ,几率为92%
apriori.py
from numpy import *# 加载数据集
def load_data_arr():return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]]# 初始化候选项集,创建元素个数为1的候选项集
def create_set_0(data_arr):# 数组set_0 = []# 对每一条交易记录for transaction in data_arr:# 对交易记录中的每件物品for item in transaction:# 如果该物品没有出现在候选项集中,则添加if not [item] in set_0:set_0.append([item])set_0.sort()# 返回一个冻结的集合,集合冻结后不能再添加或者删除元素return map(frozenset, set_0)# 扫描交易记录集,计算每个候选项集的支持度,返回满足条件的频繁项集以及所有候选项集的支持度
def scan_data_set(data_set_list, set_k, min_support):set_k_list = list(set_k)# 候选项集计数items_cnt = {}for transaction in data_set_list:for items in set_k_list:if items.issubset(transaction):if items not in items_cnt:items_cnt[items] = 1else:items_cnt[items] += 1num_transaction = len(data_set_list)# 数组return_set_k = []# 字典support_data = {}for items in items_cnt.keys():# 计算每个候选项集的支持度support = items_cnt[items]/num_transaction# 判断项集的支持度是否满足最小支持度if support >= min_support:return_set_k.append(items)# 保存每个候选项集的支持度support_data[items] = supportreturn return_set_k, support_data# 根据项个数为k+1的频繁项集set_k,生成项个数为k+2的候选项集set_k_plus
def apriori_gen(set_k, k):return_set_k_plus = []num_set_k = len(set_k)for i in range(num_set_k):for j in range(i+1, num_set_k):l1 = list(set_k[i])[:k]l2 = list(set_k[j])[:k]l1.sort()l2.sort()if l1 == l2:return_set_k_plus.append(set_k[i] | set_k[j]) #set unionreturn return_set_k_plusdef apriori(data_arr, min_support=0.3):# 创建项个数为1的候选项集set_0 = create_set_0(data_arr)data_set_list = list(map(set, data_arr))# 计算项个数为1的频繁项集set_0_scanned, all_support = scan_data_set(data_set_list, set_0, min_support)# 将项个数为1的频繁项集放入到总的频繁项集中,下标为0s = [set_0_scanned]k = 0while len(s[k]) > 0:# 根据项个数为k+1的频繁项集set_k,生成项个数为k+2的候选项集set_k_plusset_k_plus = apriori_gen(s[k], k)# 计算项个数为k+2的频繁项集set_k_plus_scannedset_k_plus_scanned, k_plus_support = scan_data_set(data_set_list, set_k_plus, min_support)# 更新all_support.update(k_plus_support)s.append(set_k_plus_scanned)k += 1return s, all_support# 计算规则的可信度
def calculate_conf(freq_item, H, support_data, big_rules_list, min_conf=0.3):pruned_H = []for consequence in H:# 通过支持度计算可信度# 规则的左侧通过作差求得conf = support_data[freq_item]/support_data[freq_item - consequence]if conf >= min_conf:big_rules_list.append((freq_item - consequence, consequence, conf))# 需要返回可信的规则的右侧,以便再次进行合并,同时抛弃不可信规则的右侧pruned_H.append(consequence)return pruned_H# 从序列中提取规则
# H是规则的右侧
def rules_from_consequence(freq_item, H, support_data, big_rules_list, min_conf=0.3):m = len(H[0])# 原书代码中此处没有等号,是不对的,读者可以结合前面给出的结束条件,判断此处是否需要添加等号if len(freq_item) >= (m+1):# 下面的两行代码,原书给出的顺序是错误的,应该先计算可信度,再合并# 读者可以根据计算出的频繁项集和支持度手动计算一下,可以发现原执行顺序会漏掉一部分规则hmp1 = calculate_conf(freq_item, H, support_data, big_rules_list, min_conf)hmp1 = apriori_gen(hmp1, m - 1)# 下面这行代码使没有用的,因为合并右侧后,肯定是需要去提取规则并计算规则可信度的。# if len(hmp1) > 1:rules_from_consequence(freq_item, hmp1, support_data, big_rules_list, min_conf)# 生成关联规则
def generate_rules(s, support_data, min_conf=0.3):big_rules_list = []for i in range(1, len(s)):for freq_set in s[i]:h1 = [frozenset([item]) for item in freq_set]if i > 1:# 项数大于2,至少为3,可以组合项,提取规则rules_from_consequence(freq_set, h1, support_data, big_rules_list, min_conf)else:calculate_conf(freq_set, h1, support_data, big_rules_list, min_conf)return big_rules_list
部分代码源自于https://blog.csdn.net/dzjin1234/article/details/105799974
这篇关于《机器学习实战Machine_Learning_in_Action》 CH11-毒蘑菇判断 by Apriori算法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!