/// <inheritdoc/> public double CalculateScore(IMLMethod algo) { IErrorCalculation ec = ErrorCalc.Create(); IRegressionAlgorithm ralgo = (IRegressionAlgorithm)algo; // evaulate ec.Clear(); foreach (BasicData pair in _trainingData) { double[] output = ralgo.ComputeRegression(pair.Input); ec.UpdateError(output, pair.Ideal, 1.0); } return(ec.Calculate()); }
/// <inheritdoc /> public double CalculateScore(IMLMethod algo) { IErrorCalculation ec = ErrorCalc.Create(); var ralgo = (IRegressionAlgorithm)algo; var genome = (IGenome)ralgo; if (genome.Count > _maxLength) { return(double.PositiveInfinity); } // evaulate ec.Clear(); foreach (BasicData pair in _trainingData) { double[] output = ralgo.ComputeRegression(pair.Input); ec.UpdateError(output, pair.Ideal, 1.0); } return(ec.Calculate()); }