Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2577 for trunk


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

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

Location:
trunk/sources
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/GPClassificationEvaluatorBase.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
    3737      ItemList<DoubleData> classes = GetVariableValue<ItemList<DoubleData>>("TargetClassValues", scope, true);
  • trunk/sources/HeuristicLab.GP.StructureIdentification.ConditionalEvaluation/3.3/ConditionalEvaluatorBase.cs

    r1926 r2577  
    4040    }
    4141
    42     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     42    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {
    4343      int maxTimeOffset = GetVariableValue<IntData>("MaxTimeOffset", scope, true).Data;
    4444      int minTimeOffset = GetVariableValue<IntData>("MinTimeOffset", scope, true).Data;
     
    6060          double original = dataset.GetValue(sample, targetVariable);
    6161          double estimated = evaluator.Evaluate(sample);
    62           if (updateTargetValues) {
    63             dataset.SetValue(sample, targetVariable, estimated);
    64           }
     62         
    6563          values[sample - start - skippedSampels, 0] = estimated;
    6664          values[sample - start - skippedSampels, 1] = original;
    6765        }
    6866      }
    69       //needed because otherwise the array is too larged dimension and therefore the sample count is false during calculation
     67      //needed because otherwise the array is too large and therefore the sample count is incorrect during calculation
    7068      ResizeArray(ref values, 2, end - start - skippedSampels);
    7169
  • trunk/sources/HeuristicLab.GP.StructureIdentification.ConditionalEvaluation/3.3/ConditionalSimpleEvaluator.cs

    r1916 r2577  
    3838    }
    3939
    40     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     40    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {
    4141      ItemList values = GetVariableValue<ItemList>("Values", scope, false, false);
    4242      if (values == null) {
     
    6868          double estimated = evaluator.Evaluate(sample);
    6969          double original = dataset.GetValue(sample, targetVariable);
    70           if (updateTargetValues) {
    71             dataset.SetValue(sample, targetVariable, estimated);
    72           }
     70         
    7371          row.Add(new DoubleData(estimated));
    7472          row.Add(new DoubleData(original));
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/AveragePercentageChangeEvaluator.cs

    r2222 r2577  
    3838    }
    3939
    40     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     40    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {
    4141      bool differential = GetVariableValue<BoolData>("Differential", scope, true).Data;
    4242      DoubleData apc = GetVariableValue<DoubleData>("APC", scope, false, false);
     
    5555          originalPercentageChange = (dataset.GetValue(sample, targetVariable) - prevOriginal) / prevOriginal;
    5656          estimatedPercentageChange = (evaluator.Evaluate(sample) - prevOriginal) / prevOriginal;
    57           if (updateTargetValues) {
    58             dataset.SetValue(sample, targetVariable, estimatedPercentageChange * prevOriginal + prevOriginal);
    59           }
     57         
    6058        } else {
    6159          originalPercentageChange = dataset.GetValue(sample, targetVariable);
    6260          estimatedPercentageChange = evaluator.Evaluate(sample);
    63           if (updateTargetValues) {
    64             dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
    65           }
     61         
    6662        }
    6763        if (!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/OffspringSelectionGPTimeSeriesPrognosis.cs

    r2566 r2577  
    4545    }
    4646
    47     public bool UseEstimatedTargetValue {
    48       get { return GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data; }
    49       set { GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data = value; }
    50     }
    51 
    5247    protected override IOperator CreateProblemInjector() {
    5348      return DefaultTimeSeriesOperators.CreateProblemInjector();
     
    7166      injector.AddVariable(new HeuristicLab.Core.Variable("MinTimeOffset", new IntData()));
    7267      injector.AddVariable(new HeuristicLab.Core.Variable("MaxTimeOffset", new IntData()));
    73       injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData()));
    7468      return injector;
    7569    }
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/ProfitEvaluator.cs

    r2222 r2577  
    3838    }
    3939
    40     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     40    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {
    4141      int exchangeRateVarIndex = GetVariableValue<IntData>("ExchangeRate", scope, true).Data;
    4242      double transactionCost = GetVariableValue<DoubleData>("TransactionCost", scope, true).Data;
     
    5454        double originalPercentageChange = dataset.GetValue(sample, targetVariable);
    5555        double estimatedPercentageChange = evaluator.Evaluate(sample);
    56         if (updateTargetValues) {
    57           dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
    58         }
     56       
    5957        if (!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) {
    6058          if (estimatedPercentageChange > 0) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/StandardGPTimeSeriesPrognosis.cs

    r2566 r2577  
    4545    }
    4646
    47     public bool UseEstimatedTargetValue {
    48       get { return GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data; }
    49       set { GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data = value; }
    50     }
    51 
    5247    protected override IOperator CreateProblemInjector() {
    5348      return DefaultTimeSeriesOperators.CreateProblemInjector();
     
    7570      injector.AddVariable(new HeuristicLab.Core.Variable("MinTimeOffset", new IntData()));
    7671      injector.AddVariable(new HeuristicLab.Core.Variable("MaxTimeOffset", new IntData()));
    77       injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData()));
    7872      return injector;
    7973    }
  • 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.