public void TestEpochCompletelyWrongEquals1UnipolarWithMargin() { Vector <double> error1 = new DenseVector(new double[] { 0.6, 0.6, 0.6 }); Vector <double> error2 = new DenseVector(new double[] { -0.6, -0.6, 0.6 }); Vector <double> error3 = new DenseVector(new double[] { 0.6, -0.6, 0.6 }); double mse1 = MSECalculator.CalculateRawMSE(error1); double mse2 = MSECalculator.CalculateRawMSE(error2); double mse3 = MSECalculator.CalculateRawMSE(error3); double rawMSESum = mse1 + mse2 + mse3; double epochMSE = MSECalculator.CalculateEpochMSE(rawMSESum, 3.0, 0.2, 0.8); Assert.AreEqual(1.0, epochMSE, 0.00001); }
public void TestEpochCompletelyWrongEquals1Unipolar() { Vector <double> error1 = new DenseVector(new double[] { 1.0, 1.0, 1.0 }); Vector <double> error2 = new DenseVector(new double[] { -1.0, -1.0, 1.0 }); Vector <double> error3 = new DenseVector(new double[] { 1.0, -1.0, 1.0 }); double mse1 = MSECalculator.CalculateRawMSE(error1); double mse2 = MSECalculator.CalculateRawMSE(error2); double mse3 = MSECalculator.CalculateRawMSE(error3); double rawMSESum = mse1 + mse2 + mse3; double epochMSE = MSECalculator.CalculateEpochMSE(rawMSESum, 3.0, Unipolar.MinValue, Unipolar.MaxValue); Assert.AreEqual(1.0, epochMSE, 0.00001); }
public void TestEpochWrongOverflowUnipolarWithMargin() { Vector <double> error1 = new DenseVector(new double[] { 0.8, 0.6, 0.6 }); Vector <double> error2 = new DenseVector(new double[] { -0.6, -0.75, 0.6 }); Vector <double> error3 = new DenseVector(new double[] { 0.6, -0.6, 0.6 }); double mse1 = MSECalculator.CalculateRawMSE(error1); double mse2 = MSECalculator.CalculateRawMSE(error2); double mse3 = MSECalculator.CalculateRawMSE(error3); double rawMSESum = mse1 + mse2 + mse3; double epochMSE = MSECalculator.CalculateEpochMSE(rawMSESum, 3.0, 0.2, 0.8); Assert.IsTrue(epochMSE > 1.0); }
protected virtual double CalculateMSEError(INetwork network, IDataSet dataSet) { double mseSum = 0.0; foreach (Pattern p in dataSet.EnumeratePatterns()) { mseSum += MSECalculator.CalculateRawMSE(p.IdealOutput - network.ComputeOutput(p.Input)); } double min; double max; Normalizor.GetMinMaxActivationWithMargin(network.Activation.MinValue, network.Activation.MaxValue, out min, out max); return(MSECalculator.CalculateEpochMSE(mseSum, dataSet.PatternCount, min, max)); }
private double CalculateEpochMSE(double mse, double count) { return(MSECalculator.CalculateEpochMSE(mse, count, minValidOutput, maxValidOutput)); }