- Timestamp:
- 02/19/14 14:04:03 (11 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r10368 r10469 120 120 <Compile Include="Plugin.cs" /> 121 121 <Compile Include="SingleObjective\ConstantOptimizationAnalyzer.cs" /> 122 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" /> 123 <Compile Include="SymbolicRegressionPruningAnalyzer.cs" /> 124 122 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" /> 123 <Compile Include="SymbolicRegressionPruningAnalyzer.cs" /> 124 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" /> 125 125 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" /> 126 126 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.cs" /> … … 145 145 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs" /> 146 146 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs" /> 147 <Compile Include="SymbolicRegressionPruningOperator.cs" /> 147 148 <Compile Include="SymbolicRegressionSolution.cs" /> 148 149 <Compile Include="SymbolicRegressionSolutionImpactValuesCalculator.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs
r10378 r10469 1 using System; 1 #region License Information 2 3 /* HeuristicLab 4 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 * 6 * This file is part of HeuristicLab. 7 * 8 * HeuristicLab is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * HeuristicLab is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #endregion 23 2 24 using HeuristicLab.Common; 3 25 using HeuristicLab.Core; 4 using HeuristicLab. Encodings.SymbolicExpressionTreeEncoding;26 using HeuristicLab.Parameters; 5 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 6 28 … … 9 31 [StorableClass] 10 32 public sealed class SymbolicRegressionPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer { 33 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator"; 34 private const string PruningOperatorParameterName = "PruningOperator"; 11 35 private SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner) 12 36 : base(original, cloner) { … … 20 44 21 45 public SymbolicRegressionPruningAnalyzer() { 22 impactValuesCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 23 } 24 25 protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, 26 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = Double.MinValue, 27 double upperEstimationLimit = Double.MaxValue) { 28 return new SymbolicRegressionModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit); 46 Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicRegressionSolutionImpactValuesCalculator())); 47 Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator())); 29 48 } 30 49 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs
r9840 r10469 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 28 26 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 30 [StorableClass] 31 [Item("SymbolicRegressionSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for regression problems.")] 27 32 public class SymbolicRegressionSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator { 33 public SymbolicRegressionSolutionImpactValuesCalculator() { } 34 35 protected SymbolicRegressionSolutionImpactValuesCalculator(SymbolicRegressionSolutionImpactValuesCalculator original, Cloner cloner) 36 : base(original, cloner) { } 37 public override IDeepCloneable Clone(Cloner cloner) { 38 return new SymbolicRegressionSolutionImpactValuesCalculator(this, cloner); 39 } 40 41 [StorableConstructor] 42 protected SymbolicRegressionSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { } 28 43 public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) { 29 44 var regressionModel = (ISymbolicRegressionModel)model; … … 34 49 35 50 public override double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN) { 51 double impactValue, replacementValue; 52 CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, originalQuality); 53 return impactValue; 54 } 55 56 public override void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, 57 IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue, 58 double originalQuality = Double.NaN) { 36 59 var regressionModel = (ISymbolicRegressionModel)model; 37 60 var regressionProblemData = (IRegressionProblemData)problemData; … … 47 70 } 48 71 49 varreplacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows);72 replacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows); 50 73 var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue }; 51 74 … … 63 86 if (errorState != OnlineCalculatorError.None) newQuality = 0.0; 64 87 65 returnoriginalQuality - newQuality;88 impactValue = originalQuality - newQuality; 66 89 } 67 68 90 } 69 91 }
Note: See TracChangeset
for help on using the changeset viewer.