Ejemplo n.º 1
0
 public void TestErrorCalc()
 {
     IErrorCalculation calc = new ErrorCalculationRMS();
     double result = ErrorTestingUtil.CalculateError(
             calc,
             ErrorTestingUtil.Actual,
             ErrorTestingUtil.Ideal);
     Assert.AreEqual(12.3134, result, 0.001);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Run the example.
        /// </summary>
        public void Process()
        {

            IErrorCalculation calcEss = new ErrorCalculationSSE();
            IErrorCalculation calcMse = new ErrorCalculationMSE();
            IErrorCalculation calcRms = new ErrorCalculationRMS();

            DataHolder smallErrors = Generate(Seed, Rows, Cols, Low, High, 0.1);
            DataHolder mediumErrors = Generate(Seed, Rows, Cols, Low, High, 0.5);
            DataHolder largeErrors = Generate(Seed, Rows, Cols, Low, High, 1.0);
            DataHolder hugeErrors = Generate(Seed, Rows, Cols, Low, High, 10.0);

            double smallEss = smallErrors.CalculateError(calcEss);
            double smallMse = smallErrors.CalculateError(calcMse);
            double smallRms = smallErrors.CalculateError(calcRms);

            double mediumEss = mediumErrors.CalculateError(calcEss);
            double mediumMse = mediumErrors.CalculateError(calcMse);
            double mediumRms = mediumErrors.CalculateError(calcRms);

            double largeEss = largeErrors.CalculateError(calcEss);
            double largeMse = largeErrors.CalculateError(calcMse);
            double largeRms = largeErrors.CalculateError(calcRms);

            double hugeEss = hugeErrors.CalculateError(calcEss);
            double hugeMse = hugeErrors.CalculateError(calcMse);
            double hugeRms = hugeErrors.CalculateError(calcRms);

            Console.WriteLine("Type\tESS\tMSE\tRMS");
            Console.WriteLine("Small\t" + (int)smallEss + "\t" + smallMse.ToString("0.0000") + "\t" + smallRms.ToString("0.0000"));
            Console.WriteLine("Medium\t" + (int)mediumEss + "\t" + mediumMse.ToString("0.0000") + "\t" + mediumRms.ToString("0.0000"));
            Console.WriteLine("Large\t" + (int)largeEss + "\t" + largeMse.ToString("0.0000") + "\t" + largeRms.ToString("0.0000"));
            Console.WriteLine("Huge\t" + (int)hugeEss + "\t" + hugeMse.ToString("0.0000") + "\t" + hugeRms.ToString("0.0000"));

        }