@Override public void resetWithMemory() { for (int i = 0; i < this.ensemble.length; i++) { Perceptron p = new Perceptron((Perceptron) this.ensemble[i]); p.setLearningRatio( ((Perceptron) getPreparedClassOption(baseLearnerOption)).learningRatioOption.getValue()); this.ensemble[i] = p; } }
@Override public double getCurrentError() { double error; if (this.perceptron != null) { if (targetMean == null) error = perceptron.getCurrentError(); else { double errorP = perceptron.getCurrentError(); double errorTM = targetMean.getCurrentError(); error = (errorP < errorTM) ? errorP : errorTM; } } else error = Double.MAX_VALUE; return error; }
protected void debuganomaly(Instance instance, double uni, double multi, double probability) { double atribSum = 0.0; double atribSquredSum = 0.0; for (int x = 0; x < instance.numAttributes() - 1; x++) { int instAttIndex = AMRulesRegressorOld.modelAttIndexToInstanceAttIndex(x, instance); atribSum = perceptron.perceptronattributeStatistics.getValue(x); atribSquredSum = perceptron.squaredperceptronattributeStatistics.getValue(x); double mean = atribSum / perceptron.getInstancesSeen(); double sd = computeSD(atribSquredSum, atribSum, perceptron.getInstancesSeen()); debug("Attribute : " + x, 5); debug("Value : " + instance.value(instAttIndex), 5); debug("Mean : " + mean, 5); debug("SD : " + sd, 5); debug("Probability : " + probability, 5); debug("Univariate : " + uni, 5); debug("Multivariate : " + multi, 5); debug("Anomaly in rule :" + this.owner.ruleNumberID, 5); } }