Пример #1
0
        private double CalculateMSETrain()
        {
            double mse = 0.0;

            for (int i = 0; i < vSetStart; i++)
            {
                Pattern p = dataSet.GetPatternAt(i);
                mse += MSECalculator.CalculateRawMSE(p.IdealOutput - network.ComputeOutput(p.Input));
            }

            return(CalculateEpochMSE(mse, vSetStart));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
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));
        }
Пример #6
0
 private double CalculateEpochMSE(double mse, double count)
 {
     return(MSECalculator.CalculateEpochMSE(mse, count, minValidOutput, maxValidOutput));
 }