private void calculateRightNWrongN() { int i, j, nData, evaClass; boolean stop; Rule rule; nData = this.train.size(); for (j = 0; j < this.ruleBase.size(); j++) { rule = this.ruleBase.get(j); rule.setIni(); } this.WrongNDefault = 0; for (i = 0; i < nData; i++) { for (j = 0; j < this.ruleBase.size(); j++) { rule = this.ruleBase.get(j); rule.matching(train.getExample(i)); } this.sort(); stop = false; for (j = 0; j < this.ruleBase.size() && !stop; j++) { rule = this.ruleBase.get(j); if (train.getOutputAsInteger(i) == rule.getClas()) { rule.incrRightN(); stop = true; } else rule.incrWrongN(); } } }
private int FRM_WR(double[] example) { int clas = -1; double max = 0.0; for (int i = 0; i < this.ruleBase.size(); i++) { Rule r = this.ruleBase.get(i); double DF = r.matching(example); if (DF > max) { max = DF; clas = r.getClas(); } } if (clas < 0) return (0); // 0 is the default class else return clas; }