Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/03/09 15:00:23 (15 years ago)
Author:
gkronber
Message:

this is the remaining part of changeset r2327.
Applied changes in modeling plugins that are necessary for the new model analyzer (#722)

  • predictor has properties for the lower and upper limit of the predicted value
  • added views for predictors that show the limits (also added a new view for GeneticProgrammingModel that shows the size and height of the model)
  • Reintroduced TreeEvaluatorInjectors that read a PunishmentFactor and calculate the lower and upper limits for estimated values (limits are set in the tree evaluators)
  • Added operators to create Predictors. Changed modeling algorithms to use the predictors for the calculation of final model qualities and variable impacts (to be compatible with the new model analyzer the predictors use a very large PunishmentFactor)
  • replaced all private implementations of double.IsAlmost and use HL.Commons instead (see #733 r2324)
  • Implemented operator SolutionExtractor and moved BestSolutionStorer from HL.Logging to HL.Modeling (fixes #734)
File:
1 edited

Legend:

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

    r2319 r2328  
    2828using HeuristicLab.GP.Interfaces;
    2929using HeuristicLab.Modeling;
     30using HeuristicLab.DataAnalysis;
    3031
    3132namespace HeuristicLab.GP.StructureIdentification {
     
    3536      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree", typeof(IGeneticProgrammingModel), VariableKind.In));
    3637      AddVariableInfo(new VariableInfo("TreeEvaluator", "The tree evaluator used to evaluate the model", typeof(ITreeEvaluator), VariableKind.In));
     38      AddVariableInfo(new VariableInfo("PunishmentFactor", "The punishment factor limits the estimated values to a certain range", typeof(DoubleData), VariableKind.In));
     39      AddVariableInfo(new VariableInfo("Dataset", "The dataset", typeof(Dataset), VariableKind.In));
     40      AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of training set", typeof(DoubleData), VariableKind.In));
     41      AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of training set", typeof(DoubleData), VariableKind.In));
     42      AddVariableInfo(new VariableInfo("TargetVariable", "Index of the target variable", typeof(IntData), VariableKind.In));
    3743      AddVariableInfo(new VariableInfo("Predictor", "The predictor combines the function tree and the evaluator and can be used to generate estimated values", typeof(IPredictor), VariableKind.New));
    3844    }
     
    4450    public override IOperation Apply(IScope scope) {
    4551      IGeneticProgrammingModel model = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true);
    46       ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true);
    47       scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), new Predictor(evaluator, model)));
     52      ITreeEvaluator evaluator = (ITreeEvaluator)GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true).Clone();
     53      double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data;
     54      Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
     55      int start = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
     56      int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
     57      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
     58      double mean = dataset.GetMean(targetVariable, start, end);
     59      double range = dataset.GetRange(targetVariable, start, end);
     60      double minEstimatedValue = mean - punishmentFactor * range;
     61      double maxEstimatedValue = mean + punishmentFactor * range;
     62      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), new Predictor(evaluator, model, minEstimatedValue, maxEstimatedValue)));
    4863      return null;
    4964    }
Note: See TracChangeset for help on using the changeset viewer.