String str = “ystemtakesinordertosolveproblemsbypruningthesystemssearchspaceforinstancebutinordertodetermineateachstepwhichrulesareapplicablethesystemmustmatchthemagainstitscurrentsituationusingcurrenttechniquesthematcherslowsdownasmoreandmorerulesareacquiredsoeachsteptakeslongerandlongerthisectcanoutweighthereductioninthenumberofstepstakensothatthenetresultisaslowdownthishasbeenobservedinseveralrecentsystemsminton1988aetzioni1990tambeetal1990cohen1990ofcoursetheproblemofslowdownfromincreasingmatchcostisnotrestrictedtosystemsinwhichthepurposeofrulesistoreducethenumberofproblemsolvingstepsasystemacquiringnewrulesforanypurposecanslowdowniftherulessignicantlyincreasethematchcostandintuitivelyoneexpectsthatthemoreproductionsthereareinasystemthehigherthetotalmatchcostwillbethethesisofthisresearchisthatwecansolvethisprobleminabroadclassofsystemsbyimprovingthematchalgorithmtheyuseinessenceouraimistoenablethescalingupofthenumberofrulesinproductionsystemsweadvancethestateoftheartinproductionmatchalgorithmsdevelopinganimprovedmatchalgorithmwhoseperformancescaleswellonasignicantlybroaderclassofsystemsthanexistingalgorithmsfurthermorewedemonstratethatbyusingthisimprovedmatchalgorithmwecanreduceoravoidtheutilityprobleminalargeclassofmachinelearningsystems”;
Map<String, Integer> map = new TreeMap<String, Integer>();
char[] ch = str.toCharArray();
for (int i = 0; i < ch.length - 1; i++) {
map.put(ch[i] + "" + ch[i + 1], map.get(ch[i] + "" + ch[i + 1]) == null ? 1 : map.get(ch[i] + "" + ch[i + 1]) + 1);
}
List<Map.Entry<String, Integer>> mapList = new ArrayList<Map.Entry<String, Integer>>(
map.entrySet());
Collections.sort(mapList, new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> num1,
Map.Entry<String, Integer> num2) {
return num1.getValue().compareTo(num2.getValue());
}
});
System.out.println(map);
int temp=0;
String strMax="";
for (Map.Entry<String, Integer> mapping : mapList) {
if(temp<mapping.getValue()){
temp= mapping.getValue();
strMax= mapping.getKey();
}
}
System.out.print("出现次数最多的"+strMax + ":共出现" +temp +"次数");
}
}
结果是th 41次
本文探讨了在规则数量增加导致匹配成本上升的问题,并提出了一种改进的匹配算法,该算法能够有效解决大规模生产系统中规则数量增长带来的性能瓶颈,通过实验证明,此算法能显著减少或避免在机器学习系统中常见的效用问题。
880

被折叠的 条评论
为什么被折叠?



