Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/01/10 19:06:18 (15 years ago)
Author:
gkronber
Message:

Remove usage of UseEstimatedTargetValue parameter. #825 (UseEstimatedTargetValue parameter should be removed from evaluation operators.)

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/EarlyStoppingMeanSquaredErrorEvaluator.cs

    r2222 r2577  
    3939
    4040    // evaluates the function-tree for the given target-variable and the whole dataset and returns the MSE
    41     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     41    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {
    4242      double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, true).Data;
    4343      DoubleData mse = GetVariableValue<DoubleData>("MSE", scope, false, false);
     
    5353        double estimated = evaluator.Evaluate(sample);
    5454        double original = dataset.GetValue(sample, targetVariable);
    55         if (updateTargetValues) {
    56           dataset.SetValue(sample, targetVariable, estimated);
    57         }
     55       
    5856        if (!double.IsNaN(original) && !double.IsInfinity(original)) {
    5957          double error = estimated - original;
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/GPEvaluatorBase.cs

    r2440 r2577  
    3636      AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
    3737      AddVariableInfo(new VariableInfo("SamplesEnd", "End index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
    38       AddVariableInfo(new VariableInfo("UseEstimatedTargetValue", "(optional) Wether to use the original (measured) or the estimated (calculated) value for the target variable for autoregressive modelling", typeof(BoolData), VariableKind.In));
    3938    }
    4039
     
    4746      int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data;
    4847      int end = GetVariableValue<IntData>("SamplesEnd", scope, true).Data;
    49       BoolData useEstimatedValuesData = GetVariableValue<BoolData>("UseEstimatedTargetValue", scope, true, false);
    50       bool useEstimatedValues = useEstimatedValuesData == null ? false : useEstimatedValuesData.Data;
    5148      ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true);
     49     
    5250      evaluator.PrepareForEvaluation(dataset, gpModel.FunctionTree);
    53 
    54       double[] backupValues = null;
    55       // prepare for autoregressive modelling by saving the original values of the target-variable to a backup array
    56       if (useEstimatedValues &&
    57         (backupValues == null || backupValues.Length != end - start)) {
    58         backupValues = new double[end - start];
    59         for (int i = start; i < end; i++) {
    60           backupValues[i - start] = dataset.GetValue(i, targetVariable);
    61         }
    62       }
    63       dataset.FireChangeEvents = false;
    64 
    65       Evaluate(scope, evaluator, dataset, targetVariable, start, end, useEstimatedValues);
    66 
    67       // restore the values of the target variable from the backup array if necessary
    68       if (useEstimatedValues) {
    69         for (int i = start; i < end; i++) {
    70           dataset.SetValue(i, targetVariable, backupValues[i - start]);
    71         }
    72       }
    73       dataset.FireChangeEvents = true;
    74       dataset.FireChanged();
     51      Evaluate(scope, evaluator, dataset, targetVariable, start, end);
    7552
    7653      // update the value of total evaluated nodes
     
    7956    }
    8057
    81     public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues);
     58    public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end);
    8259  }
    8360}
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleEvaluator.cs

    r2222 r2577  
    3131    }
    3232
    33     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     33    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {
    3434      DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, false, false);
    3535      if (values == null) {
     
    4747        double estimated = evaluator.Evaluate(sample);
    4848        double original = dataset.GetValue(sample, targetVariable);
    49         if (updateTargetValues) {
    50           dataset.SetValue(sample, targetVariable, estimated);
    51         }
     49       
    5250        v[sample - start, 0] = original;
    5351        v[sample - start, 1] = estimated;
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleGPEvaluatorBase.cs

    r2222 r2577  
    3333    }
    3434
    35     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     35    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {
    3636      // store original and estimated values in a double array
    3737      double[,] values = new double[end - start, 2];
     
    3939        double original = dataset.GetValue(sample, targetVariable);
    4040        double estimated = evaluator.Evaluate(sample);
    41         if (updateTargetValues) {
    42           dataset.SetValue(sample, targetVariable, estimated);
    43         }
     41       
    4442        values[sample - start, 0] = estimated;
    4543        values[sample - start, 1] = original;
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/UncertainMeanSquaredErrorEvaluator.cs

    r2222 r2577  
    4545
    4646    // evaluates the function-tree for the given target-variable and the whole dataset and returns the MSE
    47     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     47    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {
    4848      double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, true).Data;
    4949      int minSamples = GetVariableValue<IntData>("MinEvaluatedSamples", scope, true).Data;
Note: See TracChangeset for help on using the changeset viewer.