Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/10/09 19:05:34 (15 years ago)
Author:
gkronber
Message:

Implemented base classes for variable impact analysis and implemented specific operators for GP. #644 (Variable impact of CEDMA models should be calculated and stored in the result DB)

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators
Files:
2 added
1 edited

Legend:

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

    r1891 r2041  
    3333    public SimpleEvaluator()
    3434      : base() {
    35       AddVariableInfo(new VariableInfo("Values", "The values of the target variable as predicted by the model and the original value of the target variable", typeof(ItemList), VariableKind.New | VariableKind.Out));
     35      AddVariableInfo(new VariableInfo("Values", "Target vs. predicted values", typeof(DoubleMatrixData), VariableKind.New | VariableKind.Out));
    3636    }
    3737
    3838    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    39       ItemList values = GetVariableValue<ItemList>("Values", scope, false, false);
     39      DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, false, false);
    4040      if (values == null) {
    41         values = new ItemList();
     41        values = new DoubleMatrixData();
    4242        IVariableInfo info = GetVariableInfo("Values");
    4343        if (info.Local)
     
    4646          scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(info.FormalName), values));
    4747      }
    48       values.Clear();
     48
     49      double[,] v = new double[end - start, 2];
    4950
    5051      for (int sample = start; sample < end; sample++) {
    51         ItemList row = new ItemList();
    5252        double estimated = evaluator.Evaluate(sample);
    5353        double original = dataset.GetValue(sample, targetVariable);
     
    5555          dataset.SetValue(sample, targetVariable, estimated);
    5656        }
    57         row.Add(new DoubleData(estimated));
    58         row.Add(new DoubleData(original));
    59         values.Add(row);
     57        v[sample - start, 0] = original;
     58        v[sample - start, 1] = estimated;
    6059      }
     60      values.Data = v;
    6161    }
    6262  }
Note: See TracChangeset for help on using the changeset viewer.