Changeset 11208 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
- Timestamp:
- 07/18/14 16:39:50 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
r9456 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 37 37 [Item("SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic data analysis solution for single objective symbolic data analysis problems.")] 38 38 [StorableClass] 39 public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U> 39 public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, IIterationBasedOperator 40 40 where S : class, ISymbolicDataAnalysisSolution 41 41 where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U> … … 43 43 private const string ValidationBestSolutionParameterName = "Best validation solution"; 44 44 private const string ValidationBestSolutionQualityParameterName = "Best validation solution quality"; 45 private const string ValidationBestSolutionGenerationParameterName = "Best validation solution generation"; 45 46 private const string UpdateAlwaysParameterName = "Always update best solution"; 47 private const string IterationsParameterName = "Iterations"; 48 private const string MaximumIterationsParameterName = "Maximum Iterations"; 46 49 47 50 #region parameter properties … … 52 55 get { return (ILookupParameter<DoubleValue>)Parameters[ValidationBestSolutionQualityParameterName]; } 53 56 } 57 public ILookupParameter<IntValue> ValidationBestSolutionGenerationParameter { 58 get { return (ILookupParameter<IntValue>)Parameters[ValidationBestSolutionGenerationParameterName]; } 59 } 54 60 public IFixedValueParameter<BoolValue> UpdateAlwaysParameter { 55 61 get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; } 62 } 63 public ILookupParameter<IntValue> IterationsParameter { 64 get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; } 65 } 66 public IValueLookupParameter<IntValue> MaximumIterationsParameter { 67 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; } 56 68 } 57 69 #endregion … … 77 89 Parameters.Add(new LookupParameter<S>(ValidationBestSolutionParameterName, "The validation best symbolic data analyis solution.")); 78 90 Parameters.Add(new LookupParameter<DoubleValue>(ValidationBestSolutionQualityParameterName, "The quality of the validation best symbolic data analysis solution.")); 91 Parameters.Add(new LookupParameter<IntValue>(ValidationBestSolutionGenerationParameterName, "The generation in which the best validation solution was found.")); 79 92 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best validation solution should always be updated regardless of its quality.", new BoolValue(false))); 93 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations.")); 94 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true }); 80 95 UpdateAlwaysParameter.Hidden = true; 81 96 } … … 84 99 private void AfterDeserialization() { 85 100 if (!Parameters.ContainsKey(UpdateAlwaysParameterName)) { 86 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best trainingsolution should always be updated regardless of its quality.", new BoolValue(false)));101 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateAlwaysParameterName, "Determines if the best validation solution should always be updated regardless of its quality.", new BoolValue(false))); 87 102 UpdateAlwaysParameter.Hidden = true; 88 103 } 104 if (!Parameters.ContainsKey(ValidationBestSolutionGenerationParameterName)) 105 Parameters.Add(new LookupParameter<IntValue>(ValidationBestSolutionGenerationParameterName, "The generation in which the best validation solution was found.")); 106 if (!Parameters.ContainsKey(IterationsParameterName)) 107 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations.")); 108 if (!Parameters.ContainsKey(MaximumIterationsParameterName)) 109 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true }); 89 110 } 90 111 … … 121 142 var quality = tree 122 143 .Take(topN) 123 .AsParallel()124 144 .Select(t => evaluator.Evaluate(childContext, t, problemData, rows)) 125 145 .ToArray(); … … 138 158 ValidationBestSolution = CreateSolution(bestTree, bestValidationQuality); 139 159 ValidationBestSolutionQuality = new DoubleValue(bestValidationQuality); 160 if (IterationsParameter.ActualValue != null) 161 ValidationBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value); 140 162 141 163 if (!results.ContainsKey(ValidationBestSolutionParameter.Name)) { 142 164 results.Add(new Result(ValidationBestSolutionParameter.Name, ValidationBestSolutionParameter.Description, ValidationBestSolution)); 143 165 results.Add(new Result(ValidationBestSolutionQualityParameter.Name, ValidationBestSolutionQualityParameter.Description, ValidationBestSolutionQuality)); 166 if (ValidationBestSolutionGenerationParameter.ActualValue != null) 167 results.Add(new Result(ValidationBestSolutionGenerationParameter.Name, ValidationBestSolutionGenerationParameter.Description, ValidationBestSolutionGenerationParameter.ActualValue)); 144 168 } else { 145 169 results[ValidationBestSolutionParameter.Name].Value = ValidationBestSolution; 146 170 results[ValidationBestSolutionQualityParameter.Name].Value = ValidationBestSolutionQuality; 171 if (ValidationBestSolutionGenerationParameter.ActualValue != null) 172 results[ValidationBestSolutionGenerationParameter.Name].Value = ValidationBestSolutionGenerationParameter.ActualValue; 147 173 } 148 174 }
Note: See TracChangeset
for help on using the changeset viewer.