Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/30/10 10:04:03 (14 years ago)
Author:
gkronber
Message:

Merged changesets from revisions r4249, r4250, r4251, r4291, r4295 from trunk into data analysis exploration #1142.

Location:
branches/DataAnalysis
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis

  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj

    r4271 r4341  
    127127    </Compile>
    128128    <Compile Include="Symbolic\Analyzers\SymbolicRegressionSolutionLinearScaler.cs" />
    129     <Compile Include="Symbolic\Analyzers\SymbolicRegressionTournamentPruning.cs" />
     129    <Compile Include="Symbolic\Analyzers\SymbolicRegressionTournamentPruning.cs">
     130      <SubType>Code</SubType>
     131    </Compile>
    130132    <Compile Include="Symbolic\Analyzers\SymbolicRegressionVariableFrequencyAnalyzer.cs" />
    131133    <Compile Include="Symbolic\Analyzers\ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs" />
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r4128 r4341  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.Linq;
    2524using HeuristicLab.Common;
    2625using HeuristicLab.Core;
    2726using HeuristicLab.Data;
    28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;
    30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
    31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
    3227using HeuristicLab.Optimization;
    3328using HeuristicLab.Parameters;
    3429using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    35 using HeuristicLab.PluginInfrastructure;
    3630using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers;
    37 using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3831
    3932namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     
    8477    public SymbolicRegressionProblem()
    8578      : base() {
    86       var evaluator = new SymbolicRegressionScaledMeanSquaredErrorEvaluator();
    87       Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue(false).AsReadOnly()));
     79      var evaluator = new SymbolicRegressionPearsonsRSquaredEvaluator();
     80      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue(true)));
    8881      Parameters.Add(new ValueParameter<ISymbolicRegressionEvaluator>("Evaluator", "The operator which should be used to evaluate symbolic regression solutions.", evaluator));
    8982      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The minimal error value that reached by symbolic regression solutions for the problem."));
    9083
    91       evaluator.QualityParameter.ActualName = "TrainingMeanSquaredError";
     84      evaluator.QualityParameter.ActualName = "TrainingPearsonR2";
    9285
    9386      InitializeOperators();
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs

    r4225 r4341  
    113113    public ISymbolicExpressionGrammar FunctionTreeGrammar {
    114114      get { return (ISymbolicExpressionGrammar)FunctionTreeGrammarParameter.Value; }
     115      private set { FunctionTreeGrammarParameter.Value = value; }
    115116    }
    116117    public override IEnumerable<IOperator> Operators {
     
    190191      MaxFunctionDefiningBranchesParameter.ValueChanged += new EventHandler(ArchitectureParameter_ValueChanged);
    191192      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
     193      FunctionTreeGrammarParameter.ValueChanged += new EventHandler(FunctionTreeGrammarParameter_ValueChanged);
    192194    }
    193195
     
    211213      UpdateGrammar();
    212214    }
    213     protected virtual void OnGrammarChanged(EventArgs e) { }
     215    protected virtual void OnGrammarChanged() { UpdateGrammar(); }
    214216    protected virtual void OnOperatorsChanged(EventArgs e) { RaiseOperatorsChanged(e); }
    215217    protected virtual void OnSolutionCreatorChanged(EventArgs e) {
     
    231233
    232234    #region event handlers
     235    private void FunctionTreeGrammarParameter_ValueChanged(object sender, EventArgs e) {
     236      if (!(FunctionTreeGrammar is GlobalSymbolicExpressionGrammar))
     237        FunctionTreeGrammar = new GlobalSymbolicExpressionGrammar(FunctionTreeGrammar);
     238      OnGrammarChanged();
     239    }
     240
    233241    private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
    234242      OnSolutionCreatorChanged(e);
     
    287295      operators = new List<IOperator>();
    288296      operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
    289       operators.Add(new SymbolicRegressionTournamentPruning());
    290297      operators.Add(new SymbolicRegressionVariableFrequencyAnalyzer());
    291298      operators.Add(new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer());
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs

    r4068 r4341  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
    2829
    2930namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     
    5051
    5152    protected override void RecalculateEstimatedValues() {
    52       estimatedValues = (from x in Model.GetEstimatedValues(ProblemData, 0, ProblemData.Dataset.Rows)
    53                          let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))
    54                          select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList();
     53      int minLag = 0;
     54      var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>();
     55      if (laggedTreeNodes.Any())
     56        minLag = laggedTreeNodes.Min(node => node.Lag);
     57      IEnumerable<double> calculatedValues =
     58          from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows)
     59          let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))
     60          select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX;
     61      estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList();
    5562      OnEstimatedValuesChanged();
    5663    }
Note: See TracChangeset for help on using the changeset viewer.