Changeset 12744 for trunk/sources
- Timestamp:
- 07/12/15 11:01:59 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs
r12720 r12744 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 47 48 Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator()))); 48 49 } 50 51 [StorableHook(HookType.AfterDeserialization)] 52 private void AfterDeserialization() { 53 // BackwardsCompatibility3.3 54 55 #region Backwards compatible code, remove with 3.4 56 if (Parameters.ContainsKey(PruningOperatorParameterName)) { 57 var oldParam = Parameters[PruningOperatorParameterName] as ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>; 58 if (oldParam != null) { 59 Parameters.Remove(oldParam); 60 Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator()))); 61 } 62 } else { 63 // not yet contained 64 Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator()))); 65 } 66 67 if (Parameters.ContainsKey("PruneOnlyZeroImpactNodes")) { 68 PruningOperator.PruneOnlyZeroImpactNodes = ((IFixedValueParameter<BoolValue>)Parameters["PruneOnlyZeroImpactNodes"]).Value.Value; 69 Parameters.Remove(Parameters["PruneOnlyZeroImpactNodes"]); 70 } 71 if (Parameters.ContainsKey("ImpactThreshold")) { 72 PruningOperator.NodeImpactThreshold = ((IFixedValueParameter<DoubleValue>)Parameters["ImpactThreshold"]).Value.Value; 73 Parameters.Remove(Parameters["ImpactThreshold"]); 74 } 75 if (Parameters.ContainsKey("ImpactValuesCalculator")) { 76 PruningOperator.ImpactValuesCalculator = ((ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>)Parameters["ImpactValuesCalculator"]).Value; 77 Parameters.Remove(Parameters["ImpactValuesCalculator"]); 78 } 79 #endregion 80 } 49 81 } 50 82 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs
r12720 r12744 61 61 } 62 62 63 [StorableHook(HookType.AfterDeserialization)] 64 private void AfterDeserialization() { 65 // BackwardsCompatibility3.3 66 #region Backwards compatible code, remove with 3.4 67 base.ImpactValuesCalculator = new SymbolicClassificationSolutionImpactValuesCalculator(); 68 if (!Parameters.ContainsKey(EvaluatorParameterName)) { 69 Parameters.Add(new LookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>(EvaluatorParameterName)); 70 } 71 #endregion 72 } 73 63 74 protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) { 64 75 var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(tree, interpreter, estimationLimits.Lower, estimationLimits.Upper); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs
r12358 r12744 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Parameters; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 49 50 Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 50 51 } 52 53 [StorableHook(HookType.AfterDeserialization)] 54 private void AfterDeserialization() { 55 // BackwardsCompatibility3.3 56 57 #region Backwards compatible code, remove with 3.4 58 if (Parameters.ContainsKey(PruningOperatorParameterName)) { 59 var oldParam = Parameters[PruningOperatorParameterName] as ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>; 60 if (oldParam != null) { 61 Parameters.Remove(oldParam); 62 Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 63 } 64 } else { 65 // not yet contained 66 Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 67 } 68 69 70 if (Parameters.ContainsKey("PruneOnlyZeroImpactNodes")) { 71 PruningOperator.PruneOnlyZeroImpactNodes = ((IFixedValueParameter<BoolValue>)Parameters["PruneOnlyZeroImpactNodes"]).Value.Value; 72 Parameters.Remove(Parameters["PruneOnlyZeroImpactNodes"]); 73 } 74 if (Parameters.ContainsKey("ImpactThreshold")) { 75 PruningOperator.NodeImpactThreshold = ((IFixedValueParameter<DoubleValue>)Parameters["ImpactThreshold"]).Value.Value; 76 Parameters.Remove(Parameters["ImpactThreshold"]); 77 } 78 if (Parameters.ContainsKey("ImpactValuesCalculator")) { 79 PruningOperator.ImpactValuesCalculator = ((ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>)Parameters["ImpactValuesCalculator"]).Value; 80 Parameters.Remove(Parameters["ImpactValuesCalculator"]); 81 } 82 83 #endregion 84 } 51 85 } 52 86 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs
r12720 r12744 57 57 } 58 58 59 [StorableHook(HookType.AfterDeserialization)] 60 private void AfterDeserialization() { 61 // BackwardsCompatibility3.3 62 #region Backwards compatible code, remove with 3.4 63 base.ImpactValuesCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 64 if (!Parameters.ContainsKey(EvaluatorParameterName)) { 65 Parameters.Add(new LookupParameter<ISymbolicRegressionSingleObjectiveEvaluator>(EvaluatorParameterName)); 66 } 67 #endregion 68 } 69 59 70 protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) { 60 71 return new SymbolicRegressionModel(tree, interpreter, estimationLimits.Lower, estimationLimits.Upper); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
r12720 r12744 133 133 } 134 134 135 [StorableHook(HookType.AfterDeserialization)] 136 private void AfterDeserialization() { 137 // BackwardsCompatibility3.3 138 #region Backwards compatible code, remove with 3.4 139 if (!Parameters.ContainsKey(PrunedNodesParameterName)) { 140 Parameters.Add(new LookupParameter<IntValue>(PrunedNodesParameterName, "A counter of how many nodes were pruned.")); 141 } 142 if (!Parameters.ContainsKey(ApplyLinearScalingParameterName)) { 143 Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName)); 144 } 145 if (!Parameters.ContainsKey(ImpactValuesCalculatorParameterName)) { 146 // value must be set by derived operators (regression/classification) 147 Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName)); 148 } 149 #endregion 150 } 151 135 152 protected abstract ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits); 136 153
Note: See TracChangeset
for help on using the changeset viewer.