code: public boolean isAnomaly(Instance instance,
  			double uniVariateAnomalyProbabilityThreshold,
  			double multiVariateAnomalyProbabilityThreshold,
  			int numberOfInstanceesForAnomaly) {
  		//AMRUles is equipped with anomaly detection. If on, compute the anomaly value.
  		long perceptronIntancesSeen=this.perceptron.getInstancesSeen();
  		if ( perceptronIntancesSeen>= numberOfInstanceesForAnomaly) {
  			double attribSum;
  			double attribSquaredSum;
  			double D = 0.0;
  			double N = 0.0;
  			double anomaly;
  
  			for (int x = 0; x < instance.numAttributes() - 1; x++) {
  				// Perceptron is initialized each rule.
  				// this is a local anomaly.
  				int instAttIndex = modelAttIndexToInstanceAttIndex(x, instance);
  				attribSum = this.perceptron.perceptronattributeStatistics.getValue(x);
  				attribSquaredSum = this.perceptron.squaredperceptronattributeStatistics.getValue(x);
  				double mean = attribSum / perceptronIntancesSeen;
  				double sd = computeSD(attribSquaredSum, attribSum, perceptronIntancesSeen);
  				double probability = computeProbability(mean, sd, instance.value(instAttIndex));
  
  				if (probability > 0.0) {
  					D = D + Math.abs(Math.log(probability));
  					if (probability < uniVariateAnomalyProbabilityThreshold) {//0.10
  						N = N + Math.abs(Math.log(probability));
  					}
  				} 
  			}
  
  			anomaly = 0.0;
  			if (D != 0.0) {
  				anomaly = N / D;
  			}
  			if (anomaly >= multiVariateAnomalyProbabilityThreshold) {
  				//debuganomaly(instance,
  				//		uniVariateAnomalyProbabilityThreshold,
  				//		multiVariateAnomalyProbabilityThreshold,
  				//		anomaly);
  				return true;
  			}
  		}
  		return false;
  	}
docs: /*
  Anomaly detection