- Timestamp:
- 07/08/14 19:29:00 (10 years ago)
- Location:
- stable
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10368,10375,10378,10414,10417-10418,10428,10469-10470,11013,11025-11027
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression merged: 10368,10375,10378,10469,11025-11026
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r10907 r11145 117 117 </ItemGroup> 118 118 <ItemGroup> 119 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" />120 119 <Compile Include="Plugin.cs" /> 121 120 <Compile Include="SingleObjective\ConstantOptimizationAnalyzer.cs" /> 122 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" /> 123 <Compile Include="SingleObjective\SymbolicRegressionSolutionsAnalyzer.cs" /> 121 <Compile Include="SingleObjective\SymbolicRegressionSolutionsAnalyzer.cs" /> 122 <Compile Include="SymbolicRegressionPruningAnalyzer.cs" /> 123 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveProblem.cs" /> 124 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs" /> 125 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" /> 126 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs" /> 127 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" /> 128 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs" /> 124 129 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionLogResidualEvaluator.cs" /> 125 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" /> 126 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" /> 130 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" /> 127 131 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.cs" /> 128 132 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.cs" /> 129 133 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionConstantOptimizationEvaluator.cs" /> 130 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs" /> 134 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveEvaluator.cs" /> 135 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs" /> 136 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs" /> 131 137 <Compile Include="SymbolicRegressionModel.cs" /> 132 138 <Compile Include="Interfaces\ISymbolicRegressionModel.cs" /> … … 137 143 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveProblem.cs" /> 138 144 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs" /> 139 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveProblem.cs" />140 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs" />141 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs" />142 145 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveEvaluator.cs" /> 146 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" /> 143 147 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs" /> 144 148 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs" /> 145 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveEvaluator.cs" /> 146 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs" /> 147 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs" /> 149 <Compile Include="SymbolicRegressionPruningOperator.cs" /> 148 150 <Compile Include="SymbolicRegressionSolution.cs" /> 149 151 <Compile Include="SymbolicRegressionSolutionImpactValuesCalculator.cs" /> -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs
r10368 r11145 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 { 11 protected SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner) 33 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator"; 34 private const string PruningOperatorParameterName = "PruningOperator"; 35 private SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner) 12 36 : base(original, cloner) { 13 37 } … … 16 40 } 17 41 42 [StorableConstructor] 43 private SymbolicRegressionPruningAnalyzer(bool deserializing) : base(deserializing) { } 44 18 45 public SymbolicRegressionPruningAnalyzer() { 19 impactValuesCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 20 } 21 22 protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, 23 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = Double.MinValue, 24 double upperEstimationLimit = Double.MaxValue) { 25 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())); 26 48 } 27 49 } -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs
r10470 r11145 1 using System.Linq; 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 24 using System.Linq; 2 25 using HeuristicLab.Common; 3 26 using HeuristicLab.Core; … … 10 33 public class SymbolicRegressionPruningOperator : SymbolicDataAnalysisExpressionPruningOperator { 11 34 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator"; 12 private const string ImpactValuesCalculatorParameterDescription = "The impact values calculator to be used for figuring out the node impacts.";13 14 private const string EvaluatorParameterName = "Evaluator";15 16 public ILookupParameter<ISymbolicRegressionSingleObjectiveEvaluator> EvaluatorParameter {17 get { return (ILookupParameter<ISymbolicRegressionSingleObjectiveEvaluator>)Parameters[EvaluatorParameterName]; }18 }19 35 20 36 protected SymbolicRegressionPruningOperator(SymbolicRegressionPruningOperator original, Cloner cloner) … … 30 46 public SymbolicRegressionPruningOperator() { 31 47 var impactValuesCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 32 Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, ImpactValuesCalculatorParameterDescription, impactValuesCalculator)); 33 Parameters.Add(new LookupParameter<ISymbolicRegressionSingleObjectiveEvaluator>(EvaluatorParameterName)); 48 Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator to be used for figuring out the node impacts.", impactValuesCalculator)); 34 49 } 35 50 … … 41 56 var regressionModel = (IRegressionModel)model; 42 57 var regressionProblemData = (IRegressionProblemData)ProblemData; 43 var trainingIndices = ProblemData.TrainingIndices.ToList();58 var trainingIndices = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size); 44 59 var estimatedValues = regressionModel.GetEstimatedValues(ProblemData.Dataset, trainingIndices); // also bounds the values 45 60 var targetValues = ProblemData.Dataset.GetDoubleValues(regressionProblemData.TargetVariable, trainingIndices); -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs
r9976 r11145 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.