Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/14 19:29:00 (10 years ago)
Author:
mkommend
Message:

#2143: Merged r10368, r10375, r10378, r10414, r10417, r10418, r10428, r10469, r10470, r11013, r11025, r11026, r11027 into stable.

Location:
stable
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj

    r10907 r11145  
    117117  </ItemGroup>
    118118  <ItemGroup>
    119     <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" />
    120119    <Compile Include="Plugin.cs" />
    121120    <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" />
    124129    <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" />   
    127131    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.cs" />
    128132    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.cs" />
    129133    <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" />
    131137    <Compile Include="SymbolicRegressionModel.cs" />
    132138    <Compile Include="Interfaces\ISymbolicRegressionModel.cs" />
     
    137143    <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveProblem.cs" />
    138144    <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs" />
    139     <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveProblem.cs" />
    140     <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs" />
    141     <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs" />
    142145    <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveEvaluator.cs" />
     146    <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" />
    143147    <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs" />
    144148    <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" />
    148150    <Compile Include="SymbolicRegressionSolution.cs" />
    149151    <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
    224using HeuristicLab.Common;
    325using HeuristicLab.Core;
    4 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     26using HeuristicLab.Parameters;
    527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    628
     
    931  [StorableClass]
    1032  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)
    1236      : base(original, cloner) {
    1337    }
     
    1640    }
    1741
     42    [StorableConstructor]
     43    private SymbolicRegressionPruningAnalyzer(bool deserializing) : base(deserializing) { }
     44
    1845    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()));
    2648    }
    2749  }
  • 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
     24using System.Linq;
    225using HeuristicLab.Common;
    326using HeuristicLab.Core;
     
    1033  public class SymbolicRegressionPruningOperator : SymbolicDataAnalysisExpressionPruningOperator {
    1134    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     }
    1935
    2036    protected SymbolicRegressionPruningOperator(SymbolicRegressionPruningOperator original, Cloner cloner)
     
    3046    public SymbolicRegressionPruningOperator() {
    3147      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));
    3449    }
    3550
     
    4156      var regressionModel = (IRegressionModel)model;
    4257      var regressionProblemData = (IRegressionProblemData)ProblemData;
    43       var trainingIndices = ProblemData.TrainingIndices.ToList();
     58      var trainingIndices = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);
    4459      var estimatedValues = regressionModel.GetEstimatedValues(ProblemData.Dataset, trainingIndices); // also bounds the values
    4560      var targetValues = ProblemData.Dataset.GetDoubleValues(regressionProblemData.TargetVariable, trainingIndices);
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs

    r9976 r11145  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     25using HeuristicLab.Core;
    2426using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2528
    2629namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     30  [StorableClass]
     31  [Item("SymbolicRegressionSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for regression problems.")]
    2732  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) { }
    2843    public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
    2944      var regressionModel = (ISymbolicRegressionModel)model;
     
    3449
    3550    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) {
    3659      var regressionModel = (ISymbolicRegressionModel)model;
    3760      var regressionProblemData = (IRegressionProblemData)problemData;
     
    4770      }
    4871
    49       var replacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows);
     72      replacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows);
    5073      var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
    5174
     
    6386      if (errorState != OnlineCalculatorError.None) newQuality = 0.0;
    6487
    65       return originalQuality - newQuality;
     88      impactValue = originalQuality - newQuality;
    6689    }
    67 
    6890  }
    6991}
Note: See TracChangeset for help on using the changeset viewer.