Changeset 2332
- Timestamp:
- 09/04/09 13:57:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/PredictorBuilder.cs
r2328 r2332 56 56 int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 57 57 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) { 58 65 double mean = dataset.GetMean(targetVariable, start, end); 59 66 double range = dataset.GetRange(targetVariable, start, end); 60 67 double minEstimatedValue = mean - punishmentFactor * range; 61 68 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); 64 75 } 65 76 }
Note: See TracChangeset
for help on using the changeset viewer.