//Will work for discrete and continuous values public override double RunModelForSingleData(double[] data) { VerifyDataForRun(data); double result = _missingValue; double maxProb = Double.NegativeInfinity; DistributionNormal dn = new DistributionNormal(); //Do for each target attribute for (int idx = 0; idx < ClassMeanMatrix.Count; idx++) { double prob = 1; for (int col = 0; col < data.Length; col++) { //Multiple probability of each attribute prob = prob * dn.ProbabilityDensityFunction(data[col], ClassMeanMatrix[idx][col][0], ClassSDMatrix[idx][col][0]); } if (prob > maxProb) { maxProb = prob; result = targetValues[idx]; //It is important that this index is same as classMeanMatrix and classSDMatrix } } return(result); }
public void Statistics_zvalue_2sd() { DistributionNormal snd = new DistributionNormal(); double value = snd.ZValue(47.72, .0001); Assert.IsTrue(1.98 <= value && value <= 2.1); }
public void Statistics_Zvalue_1sd() { DistributionNormal snd = new DistributionNormal(); double value = snd.ZValue(34.13); Assert.IsTrue(0.99 <= value && value <= 1.1); }
public void Statistics_Cdf_Negative() { DistributionNormal snd = new DistributionNormal(); double value = snd.CumulativeDistributionFunction(0.0 - 1.0); Assert.IsTrue(.157 <= value && value <= .159); }
public void Statistics_Cdf_Positive() { DistributionNormal snd = new DistributionNormal(); double value = snd.CumulativeDistributionFunction(1); Assert.IsTrue(.840 <= value && value <= .842); }
public void Statistics_Cdf_Zero() { DistributionNormal snd = new DistributionNormal(); double value = snd.CumulativeDistributionFunction(0); Assert.IsTrue(.5 <= value && value <= .5); }
public void Statistics_Cdf_General() { DistributionNormal snd = new DistributionNormal(); double value = snd.CumulativeDistributionFunction(.5); Assert.IsTrue(.691 <= value && value <= .692); }
public void Statistics_Pdf_Example_3() { DistributionNormal snd = new DistributionNormal(); double value = snd.ProbabilityDensityFunction(4, 0, 1); Assert.IsTrue(SupportFunctions.DoubleCompare(value, .0001)); }
public void Statistics_Cdf_With_Seriesmax() { DistributionNormal snd = new DistributionNormal(); double value = snd.CumulativeDistributionFunction(.5, 100); Assert.IsTrue(.691 <= value && value <= .692); }
public void Statistics_Zvalue_Confidence_Internval() { DistributionNormal snd = new DistributionNormal(); double value = snd.ZValue_ConfidenceInterval(25, .0001); Assert.IsTrue(.31 <= value && value <= .32); }