Changeset 2210 for branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators
- Timestamp:
- 07/29/09 18:28:45 (15 years ago)
- Location:
- branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/GPEvaluatorBase.cs
r2130 r2210 28 28 using HeuristicLab.Operators; 29 29 using HeuristicLab.DataAnalysis; 30 using HeuristicLab.GP.Interfaces; 30 31 31 32 namespace HeuristicLab.GP.StructureIdentification { … … 34 35 : base() { 35 36 AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In)); 36 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In)); 37 AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In)); 37 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In)); 38 38 AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In)); 39 39 AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In)); … … 51 51 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data; 52 52 Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true); 53 I FunctionTree functionTree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);53 IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true); 54 54 double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data; 55 int treeSize = scope.GetVariableValue<IntData>("TreeSize", true).Data;56 55 double totalEvaluatedNodes = scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data; 57 56 int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; … … 61 60 bool useEstimatedValues = GetVariableValue<BoolData>("UseEstimatedTargetValue", scope, true).Data; 62 61 ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true); 63 evaluator.PrepareForEvaluation(dataset, targetVariable, trainingStart, trainingEnd, punishmentFactor, functionTree);62 evaluator.PrepareForEvaluation(dataset, targetVariable, trainingStart, trainingEnd, punishmentFactor, gpModel.FunctionTree); 64 63 65 64 double[] backupValues = null; … … 86 85 87 86 // update the value of total evaluated nodes 88 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * (end - start);87 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + gpModel.Size * (end - start); 89 88 return null; 90 89 } -
branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/VariableEvaluationImpactCalculator.cs
r2165 r2210 28 28 using HeuristicLab.DataAnalysis; 29 29 using System.Linq; 30 using HeuristicLab.GP.Interfaces; 30 31 31 32 namespace HeuristicLab.GP.StructureIdentification { … … 35 36 : base() { 36 37 AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In)); 37 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(I FunctionTree), VariableKind.In));38 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In)); 38 39 AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In)); 39 40 AddVariableInfo(new VariableInfo("PunishmentFactor", "Punishment factor for invalid estimations", typeof(DoubleData), VariableKind.In)); … … 43 44 protected override double[] GetOutputs(IScope scope, Dataset dataset, int targetVariable, int start, int end) { 44 45 ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true); 45 I FunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);46 IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true); 46 47 double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data; 47 evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, tree);48 evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, gpModel.FunctionTree); 48 49 49 50 double[] result = new double[end - start]; -
branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/VariableQualityImpactCalculator.cs
r2165 r2210 28 28 using HeuristicLab.DataAnalysis; 29 29 using System.Linq; 30 using HeuristicLab.GP.Interfaces; 30 31 31 32 namespace HeuristicLab.GP.StructureIdentification { … … 35 36 : base() { 36 37 AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In)); 37 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(I FunctionTree), VariableKind.In));38 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In)); 38 39 AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In)); 39 40 AddVariableInfo(new VariableInfo("PunishmentFactor", "Punishment factor for invalid estimations", typeof(DoubleData), VariableKind.In)); … … 42 43 protected override double CalculateQuality(IScope scope, Dataset dataset, int targetVariable, int start, int end) { 43 44 ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true); 44 I FunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);45 IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true); 45 46 double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data; 46 evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, tree);47 evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, gpModel.FunctionTree); 47 48 48 49 double[,] result = new double[end - start, 2];
Note: See TracChangeset
for help on using the changeset viewer.