private boolean validarRegla(Rule regla) { int i, j; for (i = 0; i < regla.getRule().length; i++) { for (j = i + 1; j < regla.getRule().length; j++) { if (regla.getiCondition(i).getAttribute() == regla.getiCondition(j).getAttribute()) return false; } } return true; }
private double computeAdjustedResidual(int data[][], int classData[], Rule regla, int clase) { double suma = 0; int i; for (i = 0; i < regla.getRule().length; i++) { suma += computeStandarizedResidual(data, classData, regla.getiCondition(i), clase) / Math.sqrt( computeMaximumLikelohoodEstimate(data, classData, regla.getiCondition(i), clase)); } return suma; }
private String consecuente( myDataset dataset, int data[][], int classData[], int infoAttr[], int nClases, Rule rule) { int k, l; double tmp1, tmp2; int pos = 0, classPredicted; double Waip; classPredicted = -1; Waip = 0; tmp1 = Double.NEGATIVE_INFINITY; for (l = 0; l < nClases; l++) { tmp2 = 0; for (k = 0; k < rule.getRule().length; k++) { tmp2 += RuleSet.computeWeightEvidence(data, classData, rule.getiCondition(k), l, infoAttr); } if (tmp2 > tmp1) { tmp1 = tmp2; pos = l; } } classPredicted = pos; Waip = tmp1; return dataset.getOutputValue(classPredicted) + " [" + Double.toString(Waip) + "]"; }
private boolean reglaPositiva( myDataset dataset, int data[][], int classData[], int infoAttr[], int nClases, Rule rule) { int k, l; double tmp1, tmp2; double Waip; Waip = 0; tmp1 = Double.NEGATIVE_INFINITY; for (l = 0; l < nClases; l++) { tmp2 = 0; for (k = 0; k < rule.getRule().length; k++) { tmp2 += RuleSet.computeWeightEvidence(data, classData, rule.getiCondition(k), l, infoAttr); } if (tmp2 > tmp1) { tmp1 = tmp2; } } Waip = tmp1; return Waip > 0 ? true : false; }