Changeset 2041 for trunk/sources/HeuristicLab.GP.StructureIdentification
- Timestamp:
- 06/10/09 19:05:34 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/AlgorithmBase.cs
r2034 r2041 423 423 model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data; 424 424 model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data; 425 // calculate and set variable impacts 426 VariableEvaluationImpactCalculator evaluationImpactCalculator = new VariableEvaluationImpactCalculator(); 427 VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator(); 428 429 evaluationImpactCalculator.Apply(bestModelScope); 430 qualityImpactCalculator.Apply(bestModelScope); 431 432 ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false); 433 ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>("VariableQualityImpacts", false); 434 foreach (ItemList row in evaluationImpacts) { 435 string variableName = ((StringData)row[0]).Data; 436 double impact = ((DoubleData)row[0]).Data; 437 model.SetVariableEvaluationImpact(variableName, impact); 438 } 439 foreach (ItemList row in qualityImpacts) { 440 string variableName = ((StringData)row[0]).Data; 441 double impact = ((DoubleData)row[0]).Data; 442 model.SetVariableQualityImpact(variableName, impact); 443 } 425 444 return model; 426 445 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleEvaluator.cs
r1891 r2041 33 33 public SimpleEvaluator() 34 34 : base() { 35 AddVariableInfo(new VariableInfo("Values", "T he 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)); 36 36 } 37 37 38 38 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); 40 40 if (values == null) { 41 values = new ItemList();41 values = new DoubleMatrixData(); 42 42 IVariableInfo info = GetVariableInfo("Values"); 43 43 if (info.Local) … … 46 46 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(info.FormalName), values)); 47 47 } 48 values.Clear(); 48 49 double[,] v = new double[end - start, 2]; 49 50 50 51 for (int sample = start; sample < end; sample++) { 51 ItemList row = new ItemList();52 52 double estimated = evaluator.Evaluate(sample); 53 53 double original = dataset.GetValue(sample, targetVariable); … … 55 55 dataset.SetValue(sample, targetVariable, estimated); 56 56 } 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; 60 59 } 60 values.Data = v; 61 61 } 62 62 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj
r2034 r2041 140 140 <Compile Include="Tangens.cs" /> 141 141 <Compile Include="Variable.cs" /> 142 <Compile Include="Evaluators\VariableEvaluationImpactCalculator.cs" /> 143 <Compile Include="Evaluators\VariableQualityImpactCalculator.cs" /> 142 144 <Compile Include="Xor.cs" /> 143 145 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.