Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/10/08 12:44:27 (16 years ago)
Author:
gkronber
Message:

made a few more improvements in the GP evaluators (ticket #242 All GP evaluators should support the 'UseEstimatedTargetValues' switch for autoregressive modelling)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanSquaredErrorEvaluator.cs

    r480 r482  
    3232namespace HeuristicLab.StructureIdentification {
    3333  public class MeanSquaredErrorEvaluator : GPEvaluatorBase {
     34    protected DoubleData mse;
    3435    public override string Description {
    3536      get {
     
    4142    public MeanSquaredErrorEvaluator()
    4243      : base() {
     44      AddVariableInfo(new VariableInfo("MSE", "The mean squared error of the model", typeof(DoubleData), VariableKind.New));
    4345    }
    4446
    45     public override double Evaluate(int start, int end) {
     47    public override IOperation Apply(IScope scope) {
     48      mse = GetVariableValue<DoubleData>("MSE", scope, false, false);
     49      if(mse == null) {
     50        mse = new DoubleData();
     51        scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("MSE"), mse));
     52      }
     53
     54      return base.Apply(scope);
     55    }
     56
     57    public override void Evaluate(int start, int end) {
    4658      double errorsSquaredSum = 0;
    4759      for(int sample = start; sample < end; sample++) {
     
    5971        errorsSquaredSum = double.MaxValue;
    6072      }
    61       return errorsSquaredSum;
     73      mse.Data = errorsSquaredSum;
    6274    }
    6375  }
Note: See TracChangeset for help on using the changeset viewer.