Apriori算法详解及java代码实现
}
}
return candidateCollection;
}
private Map<String,Integer> getItem1FC(){
Map<String,Integer> sItem1FcMap=new HashMap<String,Integer>();
Map<String,Integer> rItem1FcMap=new HashMap<String,Integer>();//频繁1项集
for(String trans:transList){
String[] items=trans.split(ITEM_SPLIT);
for(String item:items){
Integer count=sItem1FcMap.get(item+ITEM_SPLIT);
if(count==null){
sItem1FcMap.put(item+ITEM_SPLIT, 1);
}else{
sItem1FcMap.put(item+ITEM_SPLIT, count+1);
}
}
}
Set<String> keySet=sItem1FcMap.keySet();
for(String key:keySet){
Integer count=sItem1FcMap.get(key);
if(count>=SUPPORT){
rItem1FcMap.put(key, count);
}
}
return rItem1FcMap;
}
public Map<String,Double> getRelationRules(Map<String,Integer> frequentCollectionMap){