Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2332


Ignore:
Timestamp:
09/04/09 13:57:03 (15 years ago)
Author:
mkommend
Message:

added static method in PredictorBuilder to make it useable from the ModelAnalyzer (ticket #722)

File:
1 edited

Legend:

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

    r2328 r2332  
    5656      int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
    5757      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
     58      IPredictor predictor = CreatePredictor(model, evaluator, punishmentFactor, dataset, targetVariable, start, end);
     59      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), predictor));
     60      return null;
     61    }
     62
     63    public static IPredictor CreatePredictor(IGeneticProgrammingModel model, ITreeEvaluator evaluator, double punishmentFactor,
     64      Dataset dataset, int targetVariable, int start, int end) {
    5865      double mean = dataset.GetMean(targetVariable, start, end);
    5966      double range = dataset.GetRange(targetVariable, start, end);
    6067      double minEstimatedValue = mean - punishmentFactor * range;
    6168      double maxEstimatedValue = mean + punishmentFactor * range;
    62       scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), new Predictor(evaluator, model, minEstimatedValue, maxEstimatedValue)));
    63       return null;
     69      return new Predictor(evaluator, model, minEstimatedValue, maxEstimatedValue);
     70    }
     71
     72    public static IPredictor CreatePredictor(IGeneticProgrammingModel model, ITreeEvaluator evaluator, double punishmentFactor,
     73      Dataset dataset, string targetVariable, int start, int end) {
     74      return CreatePredictor(model, evaluator, punishmentFactor, dataset, dataset.GetVariableIndex(targetVariable), start, end);
    6475    }
    6576  }
Note: See TracChangeset for help on using the changeset viewer.