Changeset 3681


Ignore:
Timestamp:
05/06/10 19:02:45 (12 years ago)
Author:
gkronber
Message:

Adapted analyzers to use ScopeTreeLookupParameter and wire the depth setting correctly for

  • SymbolicExpressionTreeEncoding
  • ArtificialAntProblem
  • SymbolicRegression

#999

Location:
trunk/sources
Files:
3 added
3 deleted
9 edited
8 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAvgMaxSymbolicExpressionTreeSizeAnalyzer.cs

    r3665 r3681  
    3232using HeuristicLab.Analysis;
    3333using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
     34using System;
    3435
    3536namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers {
    3637  /// <summary>
    37   /// An operator that tracks the min avgerage and max tree size in the population.
     38  /// An operator that tracks the min avgerage and max tree size.
    3839  /// </summary>
    39   [Item("PopulationMinAvgMaxTreeSizeAnalyzer", "An operator that tracks the min avgerage and max tree size in the population.")]
     40  [Item("MinAvgMaxSymbolicExpressionTreeSizeAnalyzer", "An operator that tracks the min avgerage and max tree size.")]
    4041  [StorableClass]
    41   public sealed class PopulationMinAvgMaxTreeSizeAnalyzer : AlgorithmOperator, ISymbolicExpressionTreePopulationAnalyzer {
     42  public sealed class MinAvgMaxSymbolicExpressionTreeSizeAnalyzer : AlgorithmOperator, ISymbolicExpressionTreeAnalyzer {
    4243    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
    4344    private const string SymbolicExpressionTreeSizeParameterName = "SymbolicExpressionTreeSize";
     
    4546    private const string ResultsParameterName = "Results";
    4647
    47 
    4848    #region parameter properties
    49     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    50       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }
     49    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     50      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    5151    }
    52     public ILookupParameter<ItemArray<DoubleValue>> SymbolicExpressionTreeSizeParameter {
    53       get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters[SymbolicExpressionTreeSizeParameterName]; }
     52    public ScopeTreeLookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter {
     53      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; }
    5454    }
    5555    public ValueLookupParameter<DataTable> SymbolicExpressionTreeSizesParameter {
     
    5959      get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; }
    6060    }
     61   
     62    [Storable]
     63    private MinAverageMaxValueAnalyzer valueAnalyzer;
     64
    6165    #endregion
    62     public PopulationMinAvgMaxTreeSizeAnalyzer()
     66    public MinAvgMaxSymbolicExpressionTreeSizeAnalyzer()
    6367      : base() {
    6468      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose size should be calculated."));
     
    6973      UniformSubScopesProcessor subScopesProcessor = new UniformSubScopesProcessor();
    7074      SymbolicExpressionTreeSizeCalculator sizeCalculator = new SymbolicExpressionTreeSizeCalculator();
    71       MinAverageMaxValueAnalyzer valuesAnalyzer = new MinAverageMaxValueAnalyzer();
     75      valueAnalyzer = new MinAverageMaxValueAnalyzer();
    7276      sizeCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
    7377      sizeCalculator.SymbolicExpressionTreeSizeParameter.ActualName = SymbolicExpressionTreeSizeParameter.Name;
    74       valuesAnalyzer.ValueParameter.ActualName = sizeCalculator.SymbolicExpressionTreeSizeParameter.Name;
    75       valuesAnalyzer.ValuesParameter.ActualName = SymbolicExpressionTreeSizesParameter.Name;
    76       valuesAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
    77       valuesAnalyzer.AverageValueParameter.ActualName = "Avg. Tree Size";
    78       valuesAnalyzer.MaxValueParameter.ActualName = "Max Tree Size";
    79       valuesAnalyzer.MinValueParameter.ActualName = "Min Tree Size";
     78      valueAnalyzer.ValueParameter.ActualName = sizeCalculator.SymbolicExpressionTreeSizeParameter.Name;
     79      valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth;
     80      valueAnalyzer.ValuesParameter.ActualName = SymbolicExpressionTreeSizesParameter.Name;
     81      valueAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     82      valueAnalyzer.AverageValueParameter.ActualName = "Avg. Tree Size";
     83      valueAnalyzer.MaxValueParameter.ActualName = "Max Tree Size";
     84      valueAnalyzer.MinValueParameter.ActualName = "Min Tree Size";
    8085
    8186      OperatorGraph.InitialOperator = subScopesProcessor;
    8287      subScopesProcessor.Operator = sizeCalculator;
    83       subScopesProcessor.Successor = valuesAnalyzer;
    84       valuesAnalyzer.Successor = null;
     88      subScopesProcessor.Successor = valueAnalyzer;
     89      valueAnalyzer.Successor = null;
     90
     91      Initialize();
     92    }
     93
     94    [StorableConstructor]
     95    private MinAvgMaxSymbolicExpressionTreeSizeAnalyzer(bool deserializing) : base() { }
     96
     97    [StorableHook(HookType.AfterDeserialization)]
     98    private void Initialize() {
     99      SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged);
     100    }
     101
     102    public override IDeepCloneable Clone(Cloner cloner) {
     103      MinAvgMaxSymbolicExpressionTreeSizeAnalyzer clone = (MinAvgMaxSymbolicExpressionTreeSizeAnalyzer)base.Clone(cloner);
     104      clone.Initialize();
     105      return clone;
     106    }
     107
     108    private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) {
     109      valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
    85110    }
    86111  }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj

    r3651 r3681  
    8383  </ItemGroup>
    8484  <ItemGroup>
    85     <Compile Include="Analyzers\PopulationMinAvgMaxTreeSizeAnalyzer.cs" />
    86     <Compile Include="Analyzers\SymbolicExpressionTreeSizeAnalyzer.cs" />
     85    <Compile Include="Analyzers\MinAvgMaxSymbolicExpressionTreeSizeAnalyzer.cs" />
    8786    <Compile Include="Analyzers\SymbolicExpressionTreeSizeCalculator.cs" />
    8887    <Compile Include="ArchitectureManipulators\ArgumentCreater.cs" />
     
    103102    <Compile Include="Interfaces\ISymbolicExpressionTreeCreator.cs" />
    104103    <Compile Include="Interfaces\ISymbolicExpressionTreeCrossover.cs" />
    105     <Compile Include="Interfaces\ISymbolicExpressionTreeMultiPopulationAnalyzer.cs" />
    106     <Compile Include="Interfaces\ISymbolicExpressionTreePopulationAnalyzer.cs" />
    107104    <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" />
    108105    <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" />
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeAnalyzer.cs

    r3658 r3681  
    3535  /// </summary>
    3636  public interface ISymbolicExpressionTreeAnalyzer : IAnalyzer {
    37     ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
     37    ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
    3838  }
    3939}
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt.Views/3.3/HeuristicLab.Problems.ArtificialAnt.Views-3.3.csproj

    r3437 r3681  
    8888      <DependentUpon>AntTrailView.cs</DependentUpon>
    8989    </Compile>
     90    <Compile Include="AntTrailSymbolicExpressionTreeView.cs">
     91      <SubType>UserControl</SubType>
     92    </Compile>
     93    <Compile Include="AntTrailSymbolicExpressionTreeView.Designer.cs">
     94      <DependentUpon>AntTrailSymbolicExpressionTreeView.cs</DependentUpon>
     95    </Compile>
    9096    <Compile Include="HeuristicLabProblemsArtificialAntViewsPlugin.cs" />
    9197    <Compile Include="Properties\AssemblyInfo.cs" />
     
    112118      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
    113119      <Name>HeuristicLab.Data-3.3</Name>
     120    </ProjectReference>
     121    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.csproj">
     122      <Project>{6F42C5F8-16CD-43EE-8208-FD4573A69D85}</Project>
     123      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3</Name>
    114124    </ProjectReference>
    115125    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj">
     
    142152    </ProjectReference>
    143153  </ItemGroup>
     154  <ItemGroup>
     155    <EmbeddedResource Include="AntTrailSymbolicExpressionTreeView.resx">
     156      <DependentUpon>AntTrailSymbolicExpressionTreeView.cs</DependentUpon>
     157    </EmbeddedResource>
     158  </ItemGroup>
    144159  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    145160  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt.Views/3.3/HeuristicLabProblemsArtificialAntViewsPlugin.cs.frame

    r3437 r3681  
    3333  [PluginDependency("HeuristicLab.Data", "3.3.0.0")]
    3434  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","3.3.0.0")]
     35  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views","3.3.0.0")]
    3536  [PluginDependency("HeuristicLab.MainForm", "3.3.0.0")]
    3637  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3.0.0")]
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Analyzers/BestAntTrailAnalyzer.cs

    r3665 r3681  
    3232namespace HeuristicLab.Problems.ArtificialAnt.Analyzers {
    3333  /// <summary>
    34   /// An operator for visualizing the best ant trail of an artificial ant problem.
     34  /// An operator for analyzing the best ant trail of an artificial ant problem.
    3535  /// </summary>
    36   [Item("PopulationBestAntTrailAnalyzer", "An operator for visualizing the best ant trail of an artificial ant problem.")]
     36  [Item("BestAntTrailAnalyzer", "An operator for analyzing the best ant trail of an artificial ant problem.")]
    3737  [StorableClass]
    38   public sealed class PopulationBestAntTrailAnalyzer : SingleSuccessorOperator, IAntTrailPopulationAnalyzer {
     38  public sealed class BestAntTrailAnalyzer : SingleSuccessorOperator, IAntTrailAnalyzer {
    3939    public ILookupParameter<BoolMatrix> WorldParameter {
    4040      get { return (ILookupParameter<BoolMatrix>)Parameters["World"]; }
    4141    }
    42     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    43       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters["SymbolicExpressionTree"]; }
     42    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     43      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; }
    4444    }
    45     public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
    46       get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
     45    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     46      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
    4747    }
    4848    public ILookupParameter<IntValue> MaxTimeStepsParameter {
     
    5656    }
    5757
    58     public PopulationBestAntTrailAnalyzer()
     58    public BestAntTrailAnalyzer()
    5959      : base() {
    6060      Parameters.Add(new LookupParameter<BoolMatrix>("World", "The world with food items for the artificial ant."));
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Analyzers/IAntTrailAnalyzer.cs

    r3665 r3681  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Data;
     28using HeuristicLab.Parameters;
    2829
    2930namespace HeuristicLab.Problems.ArtificialAnt.Analyzers {
    30   public interface IAntTrailPopulationAnalyzer : IAnalyzer {
    31     ILookupParameter<ItemArray<DoubleValue>> QualityParameter { get; }
    32     ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { get; }
     31  public interface IAntTrailAnalyzer : IAnalyzer {
     32    ScopeTreeLookupParameter<DoubleValue> QualityParameter { get; }
     33    ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
    3334    ILookupParameter<BoolMatrix> WorldParameter { get; }
    3435    ILookupParameter<IntValue> MaxTimeStepsParameter { get; }
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs

    r3651 r3681  
    188188    }
    189189
    190     public IEnumerable<IAntTrailPopulationAnalyzer> AntTrailAnalyzers {
    191       get { return operators.OfType<IAntTrailPopulationAnalyzer>(); }
     190    public IEnumerable<IAntTrailAnalyzer> AntTrailAnalyzers {
     191      get { return operators.OfType<IAntTrailAnalyzer>(); }
    192192    }
    193193    #endregion
     
    299299      operators = new List<IOperator>();
    300300      operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
    301       operators.Add(new PopulationBestAntTrailAnalyzer());
    302       operators.Add(new PopulationMinAvgMaxTreeSizeAnalyzer());
     301      operators.Add(new BestAntTrailAnalyzer());
     302      operators.Add(new MinAvgMaxSymbolicExpressionTreeSizeAnalyzer());
    303303      ParameterizeAnalyzers();
    304304      ParameterizeOperators();
     
    316316    }
    317317    private void ParameterizeAnalyzers() {
    318       foreach (IAntTrailPopulationAnalyzer analyzer in AntTrailAnalyzers) {
     318      foreach (IAntTrailAnalyzer analyzer in AntTrailAnalyzers) {
    319319        analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    320320        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     
    322322        analyzer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;
    323323      }
    324       foreach (ISymbolicExpressionTreePopulationAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreePopulationAnalyzer>()) {
     324      foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {
    325325        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    326326      }
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLab.Problems.ArtificialAnt-3.3.csproj

    r3631 r3681  
    8181  </ItemGroup>
    8282  <ItemGroup>
    83     <Compile Include="Analyzers\IAntTrailPopulationAnalyzer.cs" />
    84     <Compile Include="Analyzers\PopulationBestAntTrailAnalyzer.cs" />
     83    <Compile Include="Analyzers\BestAntTrailAnalyzer.cs" />
     84    <Compile Include="Analyzers\IAntTrailAnalyzer.cs" />
    8585    <Compile Include="AntInterpreter.cs" />
    8686    <Compile Include="HeuristicLabProblemsArtificialAntPlugin.cs" />
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj

    r3666 r3681  
    8686    <Compile Include="HeuristicLabProblemsDataAnalysisRegressionPlugin.cs" />
    8787    <Compile Include="Properties\AssemblyInfo.cs" />
     88    <Compile Include="Symbolic\Analyzers\BestSymbolicRegressionSolutionAnalyzer.cs" />
     89    <Compile Include="Symbolic\Analyzers\ISymbolicRegressionAnalyzer.cs" />
     90    <Compile Include="Symbolic\Analyzers\SymbolicRegressionModelQualityAnalyzer.cs" />
    8891    <Compile Include="Symbolic\Analyzers\SymbolicRegressionModelQualityCalculator.cs" />
    89     <Compile Include="Symbolic\Analyzers\PopulationSymbolicRegressionModelQualityAnalyzer.cs" />
    90     <Compile Include="Symbolic\Analyzers\PopulationSymbolicRegressionVariableFrequencyAnalyzer.cs" />
    91     <Compile Include="Symbolic\Analyzers\PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs" />
    9292    <Compile Include="Symbolic\Analyzers\SymbolicRegressionSolutionLinearScaler.cs" />
    93     <Compile Include="Symbolic\Analyzers\ISymbolicRegressionSolutionPopulationAnalyzer.cs" />
    94     <Compile Include="Symbolic\Analyzers\PopulationBestSymbolicRegressionSolutionAnalyzer.cs" />
     93    <Compile Include="Symbolic\Analyzers\SymbolicRegressionVariableFrequencyAnalyzer.cs" />
     94    <Compile Include="Symbolic\Analyzers\ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs" />
    9595    <Compile Include="Symbolic\SimpleSymbolicRegressionEvaluator.cs" />
    9696    <Compile Include="Symbolic\SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs" />
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/BestSymbolicRegressionSolutionAnalyzer.cs

    r3665 r3681  
    3636
    3737namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
    38   [Item("PopulationBestSymbolicRegressionSolutionAnalyzer", "An operator for analyzing the best solution of symbolic regression problems given in symbolic expression tree encoding.")]
     38  [Item("BestSymbolicRegressionSolutionAnalyzer", "An operator for analyzing the best solution of symbolic regression problems given in symbolic expression tree encoding.")]
    3939  [StorableClass]
    40   public sealed class PopulationBestSymbolicRegressionSolutionAnalyzer : SingleSuccessorOperator, ISymbolicRegressionSolutionPopulationAnalyzer {
     40  public sealed class BestSymbolicRegressionSolutionAnalyzer : SingleSuccessorOperator, ISymbolicRegressionAnalyzer {
    4141    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
    4242    private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
     
    4949    private const string ResultsParameterName = "Results";
    5050
    51     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    52       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }
     51    private const string BestSolutionResultName = "Best Solution (on validiation set)";
     52    private const string BestSolutionInputvariableCountResultName = "Variables Used by Best Solution";
     53
     54    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     55      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    5356    }
    54     public ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
    55       get { return (ILookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
     57    public IValueLookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
     58      get { return (IValueLookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
    5659    }
    57     public ILookupParameter<DataAnalysisProblemData> ProblemDataParameter {
    58       get { return (ILookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
     60    public IValueLookupParameter<DataAnalysisProblemData> ProblemDataParameter {
     61      get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
    5962    }
    60     public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
    61       get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters[QualityParameterName]; }
     63    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     64      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters[QualityParameterName]; }
    6265    }
    63     public ILookupParameter<DoubleValue> UpperEstimationLimitParameter {
    64       get { return (ILookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     66    public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
     67      get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    6568    }
    66     public ILookupParameter<DoubleValue> LowerEstimationLimitParameter {
    67       get { return (ILookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     69    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
     70      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    6871    }
    6972    public ILookupParameter<SymbolicRegressionSolution> BestSolutionParameter {
     
    7780    }
    7881
    79     public PopulationBestSymbolicRegressionSolutionAnalyzer()
     82    public BestSymbolicRegressionSolutionAnalyzer()
    8083      : base() {
    8184      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees to analyze."));
    82       Parameters.Add(new LookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used for the analysis of symbolic expression trees."));
    83       Parameters.Add(new LookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data for which the symbolic expression tree is a solution."));
    84       Parameters.Add(new LookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper estimation limit that was set for the evaluation of the symbolic expression trees."));
    85       Parameters.Add(new LookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
     85      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used for the analysis of symbolic expression trees."));
     86      Parameters.Add(new ValueLookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data for which the symbolic expression tree is a solution."));
     87      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper estimation limit that was set for the evaluation of the symbolic expression trees."));
     88      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
    8689      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The qualities of the symbolic regression trees which should be analyzed."));
    8790      Parameters.Add(new LookupParameter<SymbolicRegressionSolution>(BestSolutionParameterName, "The best symbolic regression solution."));
     
    103106      SymbolicRegressionSolution solution = BestSolutionParameter.ActualValue;
    104107      if (solution == null) {
    105         var model = new SymbolicRegressionModel(interpreter, expressions[i], GetInputVariables(expressions[i]));
     108        var model = new SymbolicRegressionModel((ISymbolicExpressionTreeInterpreter)interpreter.Clone(), expressions[i], GetInputVariables(expressions[i]));
    106109        solution = new SymbolicRegressionSolution(problemData, model, lowerEstimationLimit.Value, upperEstimationLimit.Value);
    107110        BestSolutionParameter.ActualValue = solution;
    108111        BestSolutionQualityParameter.ActualValue = qualities[i];
    109         results.Add(new Result("Best Symbolic Regression Solution", solution));
     112        results.Add(new Result(BestSolutionResultName, solution));
     113        results.Add(new Result(BestSolutionInputvariableCountResultName, new IntValue(model.InputVariables.Count())));
    110114      } else {
    111115        if (BestSolutionQualityParameter.ActualValue.Value > qualities[i].Value) {
    112           var model = new SymbolicRegressionModel(interpreter, expressions[i], GetInputVariables(expressions[i]));
     116          var model = new SymbolicRegressionModel((ISymbolicExpressionTreeInterpreter)interpreter.Clone(), expressions[i], GetInputVariables(expressions[i]));
    113117          solution = new SymbolicRegressionSolution(problemData, model, lowerEstimationLimit.Value, upperEstimationLimit.Value);
    114118          BestSolutionParameter.ActualValue = solution;
    115119          BestSolutionQualityParameter.ActualValue = qualities[i];
    116           results["Best Symbolic Regression Solution"].Value = solution;
     120          results[BestSolutionResultName].Value = solution;
     121          results[BestSolutionInputvariableCountResultName].Value = new IntValue(model.InputVariables.Count());
    117122        }
    118123      }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/ISymbolicRegressionAnalyzer.cs

    r3665 r3681  
    3737
    3838namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
    39   public interface ISymbolicRegressionSolutionPopulationAnalyzer : IAnalyzer {
    40     ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { get; }
     39  public interface ISymbolicRegressionAnalyzer : IAnalyzer {
     40    ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
    4141    ILookupParameter<ResultCollection> ResultsParameter { get; }
    4242  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityAnalyzer.cs

    r3666 r3681  
    3737using HeuristicLab.Problems.DataAnalysis.Evaluators;
    3838using HeuristicLab.Optimization.Operators;
     39using System;
    3940
    4041namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
     
    4243  /// "An operator for analyzing the quality of symbolic regression solutions symbolic expression tree encoding."
    4344  /// </summary>
    44   [Item("PopulationSymbolicRegressionModelQualityAnalyzer", "An operator for analyzing the quality of symbolic regression solutions symbolic expression tree encoding.")]
     45  [Item("SymbolicRegressionModelQualityAnalyzer", "An operator for analyzing the quality of symbolic regression solutions symbolic expression tree encoding.")]
    4546  [StorableClass]
    46   public sealed class PopulationSymbolicRegressionModelQualityAnalyzer : AlgorithmOperator, ISymbolicRegressionSolutionPopulationAnalyzer {
     47  public sealed class SymbolicRegressionModelQualityAnalyzer : AlgorithmOperator, ISymbolicRegressionAnalyzer {
    4748    private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
    4849    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
     
    5455    private const string MaxTrainingMeanSquaredErrorQualityParameterName = "MaxTrainingMeanSquaredError";
    5556    private const string AverageTrainingMeanSquaredErrorQualityParameterName = "AverageTrainingMeanSquaredError";
     57    private const string BestTrainingMeanSquaredErrorQualityParameterName = "BestTrainingMeanSquaredError";
    5658
    5759    private const string TrainingAverageRelativeErrorQualityParameterName = "TrainingAverageRelativeError";
     
    5961    private const string MaxTrainingAverageRelativeErrorQualityParameterName = "MaxTrainingAverageRelativeError";
    6062    private const string AverageTrainingAverageRelativeErrorQualityParameterName = "AverageTrainingAverageRelativeError";
     63    private const string BestTrainingAverageRelativeErrorQualityParameterName = "BestTrainingAverageRelativeError";
    6164
    6265    private const string TrainingRSquaredQualityParameterName = "TrainingRSquared";
     
    6467    private const string MaxTrainingRSquaredQualityParameterName = "MaxTrainingRSquared";
    6568    private const string AverageTrainingRSquaredQualityParameterName = "AverageTrainingRSquared";
     69    private const string BestTrainingRSquaredQualityParameterName = "BestTrainingRSquared";
    6670
    6771    private const string TestMeanSquaredErrorQualityParameterName = "TestMeanSquaredError";
     
    6973    private const string MaxTestMeanSquaredErrorQualityParameterName = "MaxTestMeanSquaredError";
    7074    private const string AverageTestMeanSquaredErrorQualityParameterName = "AverageTestMeanSquaredError";
     75    private const string BestTestMeanSquaredErrorQualityParameterName = "BestTestMeanSquaredError";
    7176
    7277    private const string TestAverageRelativeErrorQualityParameterName = "TestAverageRelativeError";
     
    7479    private const string MaxTestAverageRelativeErrorQualityParameterName = "MaxTestAverageRelativeError";
    7580    private const string AverageTestAverageRelativeErrorQualityParameterName = "AverageTestAverageRelativeError";
     81    private const string BestTestAverageRelativeErrorQualityParameterName = "BestTestAverageRelativeError";
    7682
    7783    private const string TestRSquaredQualityParameterName = "TestRSquared";
     
    7985    private const string MaxTestRSquaredQualityParameterName = "MaxTestRSquared";
    8086    private const string AverageTestRSquaredQualityParameterName = "AverageTestRSquared";
     87    private const string BestTestRSquaredQualityParameterName = "BestTestRSquared";
    8188
    8289    private const string RSquaredValuesParameterName = "R-squared Values";
     
    9299
    93100    #region parameter properties
    94     public ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
    95       get { return (ILookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
    96     }
    97     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    98       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }
    99     }
    100     public ILookupParameter<DataAnalysisProblemData> ProblemDataParameter {
    101       get { return (ILookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
     101    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     102      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
     103    }
     104    public IValueLookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
     105      get { return (IValueLookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
     106    }
     107    public IValueLookupParameter<DataAnalysisProblemData> ProblemDataParameter {
     108      get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
     109    }
     110    public IValueLookupParameter<IntValue> TrainingSamplesStartParameter {
     111      get { return (IValueLookupParameter<IntValue>)Parameters[TrainingSamplesStartParameterName]; }
     112    }
     113    public IValueLookupParameter<IntValue> TrainingSamplesEndParameter {
     114      get { return (IValueLookupParameter<IntValue>)Parameters[TrainingSamplesEndParameterName]; }
     115    }
     116    public IValueLookupParameter<IntValue> TestSamplesStartParameter {
     117      get { return (IValueLookupParameter<IntValue>)Parameters[TestSamplesStartParameterName]; }
     118    }
     119    public IValueLookupParameter<IntValue> TestSamplesEndParameter {
     120      get { return (IValueLookupParameter<IntValue>)Parameters[TestSamplesEndParameterName]; }
     121    }
     122    public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
     123      get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     124    }
     125    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
     126      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    102127    }
    103128    public ILookupParameter<ResultCollection> ResultsParameter {
    104129      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
    105130    }
    106     public IValueLookupParameter<IntValue> TrainingSamplesStartParameter {
    107       get { return (IValueLookupParameter<IntValue>)Parameters[TrainingSamplesStartParameterName]; }
    108     }
    109     public IValueLookupParameter<IntValue> TrainingSamplesEndParameter {
    110       get { return (IValueLookupParameter<IntValue>)Parameters[TrainingSamplesEndParameterName]; }
    111     }
    112     public IValueLookupParameter<IntValue> TestSamplesStartParameter {
    113       get { return (IValueLookupParameter<IntValue>)Parameters[TestSamplesStartParameterName]; }
    114     }
    115     public IValueLookupParameter<IntValue> TestSamplesEndParameter {
    116       get { return (IValueLookupParameter<IntValue>)Parameters[TestSamplesEndParameterName]; }
    117     }
    118     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    119       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    120     }
    121     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    122       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    123     }
    124131    #endregion
    125132
    126     public PopulationSymbolicRegressionModelQualityAnalyzer()
     133    [Storable]
     134    private MinAverageMaxValueAnalyzer minAvgMaxTrainingMseAnalyzer;
     135    [Storable]
     136    private MinAverageMaxValueAnalyzer minAvgMaxTestMseAnalyzer;
     137    [Storable]
     138    private MinAverageMaxValueAnalyzer minAvgMaxTrainingRSquaredAnalyzer;
     139    [Storable]
     140    private MinAverageMaxValueAnalyzer minAvgMaxTestRSquaredAnalyzer;
     141    [Storable]
     142    private MinAverageMaxValueAnalyzer minAvgMaxTrainingRelErrorAnalyzer;
     143    [Storable]
     144    private MinAverageMaxValueAnalyzer minAvgMaxTestRelErrorAnalyzer;
     145
     146    public SymbolicRegressionModelQualityAnalyzer()
    127147      : base() {
    128       Parameters.Add(new LookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic expression tree."));
    129148      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees to analyze."));
    130       Parameters.Add(new LookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data containing the input varaibles for the symbolic regression problem."));
    131       Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection where the best symbolic regression solution should be stored."));
     149      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic expression tree."));
     150      Parameters.Add(new ValueLookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data containing the input varaibles for the symbolic regression problem."));
    132151      Parameters.Add(new ValueLookupParameter<IntValue>(TrainingSamplesStartParameterName, "The first index of the training data set partition on which the model quality values should be calculated."));
    133152      Parameters.Add(new ValueLookupParameter<IntValue>(TrainingSamplesEndParameterName, "The last index of the training data set partition on which the model quality values should be calculated."));
     
    136155      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees."));
    137156      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees."));
    138       Parameters.Add(new LookupParameter<DataTable>(MeanSquaredErrorValuesParameterName, "The data table to collect mean squared error values."));
    139       Parameters.Add(new LookupParameter<DataTable>(RSquaredValuesParameterName, "The data table to collect R² correlation coefficient values."));
    140       Parameters.Add(new LookupParameter<DataTable>(RelativeErrorValuesParameterName, "The data table to collect relative error values."));
     157      Parameters.Add(new ValueLookupParameter<DataTable>(MeanSquaredErrorValuesParameterName, "The data table to collect mean squared error values."));
     158      Parameters.Add(new ValueLookupParameter<DataTable>(RSquaredValuesParameterName, "The data table to collect R² correlation coefficient values."));
     159      Parameters.Add(new ValueLookupParameter<DataTable>(RelativeErrorValuesParameterName, "The data table to collect relative error values."));
     160      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection where the best symbolic regression solution should be stored."));
    141161
    142162      #region operator initialization
     
    145165      SymbolicRegressionModelQualityCalculator trainingQualityCalculator = new SymbolicRegressionModelQualityCalculator();
    146166      SymbolicRegressionModelQualityCalculator testQualityCalculator = new SymbolicRegressionModelQualityCalculator();
    147       MinAverageMaxValueCalculator minAvgMaxTrainingMseCalculator = new MinAverageMaxValueCalculator();
    148       MinAverageMaxValueCalculator minAvgMaxTestMseCalculator = new MinAverageMaxValueCalculator();
    149       MinAverageMaxValueCalculator minAvgMaxTrainingR2Calculator = new MinAverageMaxValueCalculator();
    150       MinAverageMaxValueCalculator minAvgMaxTestR2Calculator = new MinAverageMaxValueCalculator();
    151       MinAverageMaxValueCalculator minAvgMaxTrainingRelErrorCalculator = new MinAverageMaxValueCalculator();
    152       MinAverageMaxValueCalculator minAvgMaxTestRelErrorCalculator = new MinAverageMaxValueCalculator();
    153       DataTableValuesCollector mseDataTableValuesCollector = new DataTableValuesCollector();
    154       DataTableValuesCollector r2DataTableValuesCollector = new DataTableValuesCollector();
    155       DataTableValuesCollector relErrorDataTableValuesCollector = new DataTableValuesCollector();
    156       ResultsCollector resultsCollector = new ResultsCollector();
     167      minAvgMaxTrainingMseAnalyzer = new MinAverageMaxValueAnalyzer();
     168      minAvgMaxTestMseAnalyzer = new MinAverageMaxValueAnalyzer();
     169
     170      minAvgMaxTrainingRSquaredAnalyzer = new MinAverageMaxValueAnalyzer();
     171      minAvgMaxTestRSquaredAnalyzer = new MinAverageMaxValueAnalyzer();
     172
     173      minAvgMaxTrainingRelErrorAnalyzer = new MinAverageMaxValueAnalyzer();
     174      minAvgMaxTestRelErrorAnalyzer = new MinAverageMaxValueAnalyzer();
    157175      #endregion
    158176
    159177      #region parameter wiring
    160       trainingQualityCalculator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.ActualName;
    161       trainingQualityCalculator.ProblemDataParameter.ActualName = ProblemDataParameter.ActualName;
    162       trainingQualityCalculator.SamplesStartParameter.ActualName = TrainingSamplesStartParameter.ActualName;
    163       trainingQualityCalculator.SamplesEndParameter.ActualName = TrainingSamplesEndParameter.ActualName;
    164       trainingQualityCalculator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.ActualName;
    165       trainingQualityCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.ActualName;
    166       trainingQualityCalculator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.ActualName;
     178      trainingQualityCalculator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     179      trainingQualityCalculator.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
     180      trainingQualityCalculator.SamplesStartParameter.ActualName = TrainingSamplesStartParameter.Name;
     181      trainingQualityCalculator.SamplesEndParameter.ActualName = TrainingSamplesEndParameter.Name;
     182      trainingQualityCalculator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
     183      trainingQualityCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
     184      trainingQualityCalculator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
    167185      trainingQualityCalculator.AverageRelativeErrorQualityParameter.ActualName = TrainingAverageRelativeErrorQualityParameterName;
    168186      trainingQualityCalculator.MeanSquaredErrorQualityParameter.ActualName = TrainingMeanSquaredErrorQualityParameterName;
    169187      trainingQualityCalculator.RSquaredQualityParameter.ActualName = TrainingRSquaredQualityParameterName;
    170188
    171       testQualityCalculator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.ActualName;
    172       testQualityCalculator.ProblemDataParameter.ActualName = ProblemDataParameter.ActualName;
    173       testQualityCalculator.SamplesStartParameter.ActualName = TestSamplesStartParameter.ActualName;
    174       testQualityCalculator.SamplesEndParameter.ActualName = TestSamplesEndParameter.ActualName;
    175       testQualityCalculator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.ActualName;
    176       testQualityCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.ActualName;
    177       testQualityCalculator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.ActualName;
     189      testQualityCalculator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     190      testQualityCalculator.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
     191      testQualityCalculator.SamplesStartParameter.ActualName = TestSamplesStartParameter.Name;
     192      testQualityCalculator.SamplesEndParameter.ActualName = TestSamplesEndParameter.Name;
     193      testQualityCalculator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
     194      testQualityCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
     195      testQualityCalculator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
    178196      testQualityCalculator.AverageRelativeErrorQualityParameter.ActualName = TestAverageRelativeErrorQualityParameterName;
    179197      testQualityCalculator.MeanSquaredErrorQualityParameter.ActualName = TestMeanSquaredErrorQualityParameterName;
    180198      testQualityCalculator.RSquaredQualityParameter.ActualName = TestRSquaredQualityParameterName;
    181 
    182       #region training min/avg/max
    183       minAvgMaxTrainingMseCalculator.AverageValueParameter.ActualName = AverageTrainingMeanSquaredErrorQualityParameterName;
    184       minAvgMaxTrainingMseCalculator.MaxValueParameter.ActualName = MaxTrainingMeanSquaredErrorQualityParameterName;
    185       minAvgMaxTrainingMseCalculator.MinValueParameter.ActualName = MinTrainingMeanSquaredErrorQualityParameterName;
    186       minAvgMaxTrainingMseCalculator.ValueParameter.ActualName = TrainingMeanSquaredErrorQualityParameterName;
    187 
    188       minAvgMaxTrainingR2Calculator.AverageValueParameter.ActualName = AverageTrainingRSquaredQualityParameterName;
    189       minAvgMaxTrainingR2Calculator.MaxValueParameter.ActualName = MaxTrainingRSquaredQualityParameterName;
    190       minAvgMaxTrainingR2Calculator.MinValueParameter.ActualName = MinTrainingRSquaredQualityParameterName;
    191       minAvgMaxTrainingR2Calculator.ValueParameter.ActualName = TrainingRSquaredQualityParameterName;
    192 
    193       minAvgMaxTrainingRelErrorCalculator.AverageValueParameter.ActualName = AverageTrainingAverageRelativeErrorQualityParameterName;
    194       minAvgMaxTrainingRelErrorCalculator.MaxValueParameter.ActualName = MaxTrainingAverageRelativeErrorQualityParameterName;
    195       minAvgMaxTrainingRelErrorCalculator.MinValueParameter.ActualName = MinTrainingAverageRelativeErrorQualityParameterName;
    196       minAvgMaxTrainingRelErrorCalculator.ValueParameter.ActualName = TrainingAverageRelativeErrorQualityParameterName;
    197       #endregion
    198 
    199       #region test min/avg/max
    200       minAvgMaxTestMseCalculator.AverageValueParameter.ActualName = AverageTestMeanSquaredErrorQualityParameterName;
    201       minAvgMaxTestMseCalculator.MaxValueParameter.ActualName = MaxTestMeanSquaredErrorQualityParameterName;
    202       minAvgMaxTestMseCalculator.MinValueParameter.ActualName = MinTestMeanSquaredErrorQualityParameterName;
    203       minAvgMaxTestMseCalculator.ValueParameter.ActualName = TestMeanSquaredErrorQualityParameterName;
    204 
    205       minAvgMaxTestR2Calculator.AverageValueParameter.ActualName = AverageTestRSquaredQualityParameterName;
    206       minAvgMaxTestR2Calculator.MaxValueParameter.ActualName = MaxTestRSquaredQualityParameterName;
    207       minAvgMaxTestR2Calculator.MinValueParameter.ActualName = MinTestRSquaredQualityParameterName;
    208       minAvgMaxTestR2Calculator.ValueParameter.ActualName = TestRSquaredQualityParameterName;
    209 
    210       minAvgMaxTestRelErrorCalculator.AverageValueParameter.ActualName = AverageTestAverageRelativeErrorQualityParameterName;
    211       minAvgMaxTestRelErrorCalculator.MaxValueParameter.ActualName = MaxTestAverageRelativeErrorQualityParameterName;
    212       minAvgMaxTestRelErrorCalculator.MinValueParameter.ActualName = MinTestAverageRelativeErrorQualityParameterName;
    213       minAvgMaxTestRelErrorCalculator.ValueParameter.ActualName = TestAverageRelativeErrorQualityParameterName;
    214       #endregion
    215 
    216       mseDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AverageTrainingMeanSquaredErrorQualityParameterName, null, AverageTrainingMeanSquaredErrorQualityParameterName));
    217       mseDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MaxTrainingMeanSquaredErrorQualityParameterName, null, MaxTrainingMeanSquaredErrorQualityParameterName));
    218       mseDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MinTrainingMeanSquaredErrorQualityParameterName, null, MinTrainingMeanSquaredErrorQualityParameterName));
    219       mseDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AverageTestMeanSquaredErrorQualityParameterName, null, AverageTestMeanSquaredErrorQualityParameterName));
    220       mseDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MaxTestMeanSquaredErrorQualityParameterName, null, MaxTestMeanSquaredErrorQualityParameterName));
    221       mseDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MinTestMeanSquaredErrorQualityParameterName, null, MinTestMeanSquaredErrorQualityParameterName));
    222       mseDataTableValuesCollector.DataTableParameter.ActualName = MeanSquaredErrorValuesParameterName;
    223 
    224       r2DataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AverageTrainingRSquaredQualityParameterName, null, AverageTrainingRSquaredQualityParameterName));
    225       r2DataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MaxTrainingRSquaredQualityParameterName, null, MaxTrainingRSquaredQualityParameterName));
    226       r2DataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MinTrainingRSquaredQualityParameterName, null, MinTrainingRSquaredQualityParameterName));
    227       r2DataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AverageTestRSquaredQualityParameterName, null, AverageTestRSquaredQualityParameterName));
    228       r2DataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MaxTestRSquaredQualityParameterName, null, MaxTestRSquaredQualityParameterName));
    229       r2DataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MinTestRSquaredQualityParameterName, null, MinTestRSquaredQualityParameterName));
    230       r2DataTableValuesCollector.DataTableParameter.ActualName = RSquaredValuesParameterName;
    231 
    232       relErrorDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AverageTrainingAverageRelativeErrorQualityParameterName, null, AverageTrainingAverageRelativeErrorQualityParameterName));
    233       relErrorDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MaxTrainingAverageRelativeErrorQualityParameterName, null, MaxTrainingAverageRelativeErrorQualityParameterName));
    234       relErrorDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MinTrainingAverageRelativeErrorQualityParameterName, null, MinTrainingAverageRelativeErrorQualityParameterName));
    235       relErrorDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(AverageTestAverageRelativeErrorQualityParameterName, null, AverageTestAverageRelativeErrorQualityParameterName));
    236       relErrorDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MaxTestAverageRelativeErrorQualityParameterName, null, MaxTestAverageRelativeErrorQualityParameterName));
    237       relErrorDataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(MinTestAverageRelativeErrorQualityParameterName, null, MinTestAverageRelativeErrorQualityParameterName));
    238       relErrorDataTableValuesCollector.DataTableParameter.ActualName = RelativeErrorValuesParameterName;
    239 
    240       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(MeanSquaredErrorValuesParameterName));
    241       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(RSquaredValuesParameterName));
    242       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(RelativeErrorValuesParameterName));
    243       resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
    244 
     199      #region training/test MSE
     200      minAvgMaxTrainingMseAnalyzer.ValueParameter.ActualName = TrainingMeanSquaredErrorQualityParameterName;
     201      minAvgMaxTrainingMseAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     202      minAvgMaxTrainingMseAnalyzer.AverageValueParameter.ActualName = AverageTrainingMeanSquaredErrorQualityParameterName;
     203      minAvgMaxTrainingMseAnalyzer.MaxValueParameter.ActualName = MaxTrainingMeanSquaredErrorQualityParameterName;
     204      minAvgMaxTrainingMseAnalyzer.MinValueParameter.ActualName = MinTrainingMeanSquaredErrorQualityParameterName;
     205      minAvgMaxTrainingMseAnalyzer.ValuesParameter.ActualName = MeanSquaredErrorValuesParameterName;
     206      minAvgMaxTrainingMseAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     207
     208      minAvgMaxTestMseAnalyzer.ValueParameter.ActualName = TestMeanSquaredErrorQualityParameterName;
     209      minAvgMaxTestMseAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     210      minAvgMaxTestMseAnalyzer.AverageValueParameter.ActualName = AverageTestMeanSquaredErrorQualityParameterName;
     211      minAvgMaxTestMseAnalyzer.MaxValueParameter.ActualName = MaxTestMeanSquaredErrorQualityParameterName;
     212      minAvgMaxTestMseAnalyzer.MinValueParameter.ActualName = MinTestMeanSquaredErrorQualityParameterName;
     213      minAvgMaxTestMseAnalyzer.ValuesParameter.ActualName = MeanSquaredErrorValuesParameterName;
     214      minAvgMaxTestMseAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     215      #endregion
     216      #region training/test R²
     217      minAvgMaxTrainingRSquaredAnalyzer.ValueParameter.ActualName = TrainingRSquaredQualityParameterName;
     218      minAvgMaxTrainingRSquaredAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     219      minAvgMaxTrainingRSquaredAnalyzer.AverageValueParameter.ActualName = AverageTrainingRSquaredQualityParameterName;
     220      minAvgMaxTrainingRSquaredAnalyzer.MaxValueParameter.ActualName = MaxTrainingRSquaredQualityParameterName;
     221      minAvgMaxTrainingRSquaredAnalyzer.MinValueParameter.ActualName = MinTrainingRSquaredQualityParameterName;
     222      minAvgMaxTrainingRSquaredAnalyzer.ValuesParameter.ActualName = RSquaredValuesParameterName;
     223      minAvgMaxTrainingRSquaredAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     224
     225      minAvgMaxTestRSquaredAnalyzer.ValueParameter.ActualName = TestRSquaredQualityParameterName;
     226      minAvgMaxTestRSquaredAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     227      minAvgMaxTestRSquaredAnalyzer.AverageValueParameter.ActualName = AverageTestRSquaredQualityParameterName;
     228      minAvgMaxTestRSquaredAnalyzer.MaxValueParameter.ActualName = MaxTestRSquaredQualityParameterName;
     229      minAvgMaxTestRSquaredAnalyzer.MinValueParameter.ActualName = MinTestRSquaredQualityParameterName;
     230      minAvgMaxTestRSquaredAnalyzer.ValuesParameter.ActualName = RSquaredValuesParameterName;
     231      minAvgMaxTestRSquaredAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     232      #endregion
     233      #region training/test avg. rel. error
     234      minAvgMaxTrainingRelErrorAnalyzer.ValueParameter.ActualName = TrainingAverageRelativeErrorQualityParameterName;
     235      minAvgMaxTrainingRelErrorAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     236      minAvgMaxTrainingRelErrorAnalyzer.AverageValueParameter.ActualName = AverageTrainingAverageRelativeErrorQualityParameterName;
     237      minAvgMaxTrainingRelErrorAnalyzer.MaxValueParameter.ActualName = MaxTrainingAverageRelativeErrorQualityParameterName;
     238      minAvgMaxTrainingRelErrorAnalyzer.MinValueParameter.ActualName = MinTrainingAverageRelativeErrorQualityParameterName;
     239      minAvgMaxTrainingRelErrorAnalyzer.ValuesParameter.ActualName = RelativeErrorValuesParameterName;
     240      minAvgMaxTrainingRelErrorAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     241
     242      minAvgMaxTestRelErrorAnalyzer.ValueParameter.ActualName = TestAverageRelativeErrorQualityParameterName;
     243      minAvgMaxTestRelErrorAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     244      minAvgMaxTestRelErrorAnalyzer.AverageValueParameter.ActualName = AverageTestAverageRelativeErrorQualityParameterName;
     245      minAvgMaxTestRelErrorAnalyzer.MaxValueParameter.ActualName = MaxTestAverageRelativeErrorQualityParameterName;
     246      minAvgMaxTestRelErrorAnalyzer.MinValueParameter.ActualName = MinTestAverageRelativeErrorQualityParameterName;
     247      minAvgMaxTestRelErrorAnalyzer.ValuesParameter.ActualName = RelativeErrorValuesParameterName;
     248      minAvgMaxTestRelErrorAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     249      #endregion
    245250      #endregion
    246251
     
    250255      trainingQualityCalculator.Successor = testQualityCalculator;
    251256      testQualityCalculator.Successor = null;
    252       subScopesProcessor.Successor = minAvgMaxTrainingMseCalculator;
    253       minAvgMaxTrainingMseCalculator.Successor = minAvgMaxTestMseCalculator;
    254       minAvgMaxTestMseCalculator.Successor = minAvgMaxTrainingR2Calculator;
    255       minAvgMaxTrainingR2Calculator.Successor = minAvgMaxTestR2Calculator;
    256       minAvgMaxTestR2Calculator.Successor = minAvgMaxTrainingRelErrorCalculator;
    257       minAvgMaxTrainingRelErrorCalculator.Successor = minAvgMaxTestRelErrorCalculator;
    258       minAvgMaxTestRelErrorCalculator.Successor = mseDataTableValuesCollector;
    259       mseDataTableValuesCollector.Successor = r2DataTableValuesCollector;
    260       r2DataTableValuesCollector.Successor = relErrorDataTableValuesCollector;
    261       relErrorDataTableValuesCollector.Successor = resultsCollector;
    262       #endregion
    263 
     257      subScopesProcessor.Successor = minAvgMaxTrainingMseAnalyzer;
     258      minAvgMaxTrainingMseAnalyzer.Successor = minAvgMaxTestMseAnalyzer;
     259      minAvgMaxTestMseAnalyzer.Successor = minAvgMaxTrainingRSquaredAnalyzer;
     260      minAvgMaxTrainingRSquaredAnalyzer.Successor = minAvgMaxTestRSquaredAnalyzer;
     261      minAvgMaxTestRSquaredAnalyzer.Successor = minAvgMaxTrainingRelErrorAnalyzer;
     262      minAvgMaxTrainingRelErrorAnalyzer.Successor = minAvgMaxTestRelErrorAnalyzer;
     263      minAvgMaxTestRelErrorAnalyzer.Successor = null;
     264      #endregion
     265
     266      Initialize();
     267    }
     268
     269    [StorableConstructor]
     270    private SymbolicRegressionModelQualityAnalyzer(bool deserializing) : base() { }
     271
     272    [StorableHook(HookType.AfterDeserialization)]
     273    private void Initialize() {
     274      SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged);
     275    }
     276
     277    public override IDeepCloneable Clone(Cloner cloner) {
     278      SymbolicRegressionModelQualityAnalyzer clone = (SymbolicRegressionModelQualityAnalyzer)base.Clone(cloner);
     279      clone.Initialize();
     280      return clone;
     281    }
     282
     283    private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) {
     284      minAvgMaxTrainingMseAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     285      minAvgMaxTrainingRelErrorAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     286      minAvgMaxTrainingRSquaredAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     287      minAvgMaxTestMseAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     288      minAvgMaxTestRelErrorAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     289      minAvgMaxTestRSquaredAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
    264290    }
    265291  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityCalculator.cs

    r3666 r3681  
    5757
    5858    #region parameter properties
    59     public ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
    60       get { return (ILookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
     59    public IValueLookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
     60      get { return (IValueLookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
    6161    }
    62     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    63       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }
     62    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     63      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    6464    }
    65     public ILookupParameter<DataAnalysisProblemData> ProblemDataParameter {
    66       get { return (ILookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
     65    public IValueLookupParameter<DataAnalysisProblemData> ProblemDataParameter {
     66      get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
    6767    }
    6868    public IValueLookupParameter<IntValue> SamplesStartParameter {
     
    7878      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    7979    }
    80     public IValueLookupParameter<DoubleValue> RSquaredQualityParameter {
    81       get { return (IValueLookupParameter<DoubleValue>)Parameters[RSQuaredQualityParameterName]; }
     80    public ILookupParameter<DoubleValue> RSquaredQualityParameter {
     81      get { return (ILookupParameter<DoubleValue>)Parameters[RSQuaredQualityParameterName]; }
    8282    }
    83     public IValueLookupParameter<DoubleValue> AverageRelativeErrorQualityParameter {
    84       get { return (IValueLookupParameter<DoubleValue>)Parameters[RelativeErrorQualityParameterName]; }
     83    public ILookupParameter<DoubleValue> AverageRelativeErrorQualityParameter {
     84      get { return (ILookupParameter<DoubleValue>)Parameters[RelativeErrorQualityParameterName]; }
    8585    }
    86     public IValueLookupParameter<DoubleValue> MeanSquaredErrorQualityParameter {
    87       get { return (IValueLookupParameter<DoubleValue>)Parameters[MeanSquaredErrorQualityParameterName]; }
     86    public ILookupParameter<DoubleValue> MeanSquaredErrorQualityParameter {
     87      get { return (ILookupParameter<DoubleValue>)Parameters[MeanSquaredErrorQualityParameterName]; }
    8888    }
    8989    #endregion
     
    9191    public SymbolicRegressionModelQualityCalculator()
    9292      : base() {
    93       Parameters.Add(new LookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic expression tree."));
    94       Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees to analyze."));
    95       Parameters.Add(new LookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data containing the input varaibles for the symbolic regression problem."));
     93      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic expression tree."));
     94      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree to analyze."));
     95      Parameters.Add(new ValueLookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data containing the input varaibles for the symbolic regression problem."));
    9696      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The first index of the data set partition on which the model quality values should be calculated."));
    9797      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The first index of the data set partition on which the model quality values should be calculated."));
     
    107107      SimpleMeanAbsolutePercentageErrorEvaluator simpleRelErrorEvaluator = new SimpleMeanAbsolutePercentageErrorEvaluator();
    108108      SimpleMSEEvaluator simpleMseEvaluator = new SimpleMSEEvaluator();
     109      Assigner clearValues = new Assigner();
    109110      #endregion
    110111
     
    127128      simpleRelErrorEvaluator.ValuesParameter.ActualName = ValuesParameterName;
    128129      simpleRelErrorEvaluator.AverageRelativeErrorParameter.ActualName = AverageRelativeErrorQualityParameter.Name;
     130
     131      clearValues.LeftSideParameter.ActualName = ValuesParameterName;
     132      clearValues.RightSideParameter.Value = new DoubleMatrix();
    129133      #endregion
    130134
     
    134138      simpleR2Evalator.Successor = simpleRelErrorEvaluator;
    135139      simpleRelErrorEvaluator.Successor = simpleMseEvaluator;
    136       simpleMseEvaluator.Successor = null;
     140      simpleMseEvaluator.Successor = clearValues;
     141      clearValues.Successor = null;
    137142      #endregion
    138143
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionVariableFrequencyAnalyzer.cs

    r3665 r3681  
    3737
    3838namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
    39   [Item("PopulationSymbolicRegressionVariableFrequencyAnalyzer", "An operator for analyzing the variable frequencies in a population of symbolic regression solutions given in symbolic expression tree encoding.")]
     39  [Item("SymbolicRegressionVariableFrequencyAnalyzer", "An operator for analyzing the variable frequencies of symbolic regression solutions given in symbolic expression tree encoding.")]
    4040  [StorableClass]
    41   public sealed class PopulationSymbolicRegressionVariableFrequencyAnalyzer : SingleSuccessorOperator, ISymbolicRegressionSolutionPopulationAnalyzer {
     41  public sealed class SymbolicRegressionVariableFrequencyAnalyzer : SingleSuccessorOperator, ISymbolicRegressionAnalyzer {
    4242    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
    4343    private const string ProblemDataParameterName = "ProblemData";
     
    4646
    4747    #region parameter properties
    48     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    49       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }
     48    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     49      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    5050    }
    5151    public ILookupParameter<DataTable> VariableFrequenciesParameter {
     
    6666    #endregion
    6767
    68     public PopulationSymbolicRegressionVariableFrequencyAnalyzer()
     68    public SymbolicRegressionVariableFrequencyAnalyzer()
    6969      : base() {
    7070      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees to analyze."));
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r3665 r3681  
    3434using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
    3535using HeuristicLab.Problems.DataAnalysis;
     36using HeuristicLab.Analysis;
     37using System;
     38using HeuristicLab.Optimization.Operators;
    3639
    3740namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
     
    3942  /// An operator that analyzes the validation best scaled symbolic regression solution.
    4043  /// </summary>
    41   [Item("PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer", "An operator that analyzes the validation best scaled symbolic regression solution.")]
     44  [Item("ValidationBestScaledSymbolicRegressionSolutionAnalyzer", "An operator that analyzes the validation best scaled symbolic regression solution.")]
    4245  [StorableClass]
    43   public sealed class PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer : AlgorithmOperator, ISymbolicRegressionSolutionPopulationAnalyzer {
     46  public sealed class ValidationBestScaledSymbolicRegressionSolutionAnalyzer : AlgorithmOperator, ISymbolicRegressionAnalyzer {
    4447    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
    4548    private const string ScaledSymbolicExpressionTreeParameterName = "ScaledSymbolicExpressionTree";
     
    5760    private const string ResultsParameterName = "Results";
    5861
    59     public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {
    60       get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }
    61     }
    62     public ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
    63       get { return (ILookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
    64     }
    65     public ILookupParameter<DataAnalysisProblemData> ProblemDataParameter {
    66       get { return (ILookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
     62    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     63      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
     64    }
     65    public IValueLookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
     66      get { return (IValueLookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
     67    }
     68    public IValueLookupParameter<DataAnalysisProblemData> ProblemDataParameter {
     69      get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
    6770    }
    6871    public IValueLookupParameter<IntValue> SamplesStartParameter {
     
    7275      get { return (IValueLookupParameter<IntValue>)Parameters[SamplesEndParameterName]; }
    7376    }
    74     public ILookupParameter<DoubleValue> UpperEstimationLimitParameter {
    75       get { return (ILookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    76     }
    77     public ILookupParameter<DoubleValue> LowerEstimationLimitParameter {
    78       get { return (ILookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     77    public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
     78      get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     79    }
     80    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
     81      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    7982    }
    8083    public ILookupParameter<SymbolicRegressionSolution> BestSolutionParameter {
     
    8891    }
    8992
    90     public PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer()
     93    [Storable]
     94    private BestQualityMemorizer validationQualityMemorizer;
     95    [Storable]
     96    private BestSymbolicRegressionSolutionAnalyzer bestSolutionAnalyzer;
     97
     98    public ValidationBestScaledSymbolicRegressionSolutionAnalyzer()
    9199      : base() {
    92100      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees to analyze."));
    93       Parameters.Add(new LookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used for the analysis of symbolic expression trees."));
    94       Parameters.Add(new LookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data for which the symbolic expression tree is a solution."));
     101      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used for the analysis of symbolic expression trees."));
     102      Parameters.Add(new ValueLookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data for which the symbolic expression tree is a solution."));
    95103      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The first index of the validation partition of the data set."));
    96104      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The last index of the validation partition of the data set."));
    97       Parameters.Add(new LookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper estimation limit that was set for the evaluation of the symbolic expression trees."));
    98       Parameters.Add(new LookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
     105      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper estimation limit that was set for the evaluation of the symbolic expression trees."));
     106      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
    99107      Parameters.Add(new LookupParameter<SymbolicRegressionSolution>(BestSolutionParameterName, "The best symbolic regression solution."));
    100108      Parameters.Add(new LookupParameter<DoubleValue>(BestSolutionQualityParameterName, "The quality of the best symbolic regression solution."));
     
    105113      SymbolicRegressionSolutionLinearScaler linearScaler = new SymbolicRegressionSolutionLinearScaler();
    106114      SymbolicRegressionMeanSquaredErrorEvaluator validationMseEvaluator = new SymbolicRegressionMeanSquaredErrorEvaluator();
    107       PopulationBestSymbolicRegressionSolutionAnalyzer bestSolutionAnalyzer = new PopulationBestSymbolicRegressionSolutionAnalyzer();
     115      bestSolutionAnalyzer = new BestSymbolicRegressionSolutionAnalyzer();
     116      validationQualityMemorizer = new BestQualityMemorizer();
     117      BestAverageWorstQualityCalculator bestAvgWorstValidationQualityCalculator = new BestAverageWorstQualityCalculator();
     118      DataTableValuesCollector validationValuesCollector = new DataTableValuesCollector();
     119      ResultsCollector resultsCollector = new ResultsCollector();
    108120      #endregion
    109121
     
    111123      linearScaler.AlphaParameter.ActualName = AlphaParameterName;
    112124      linearScaler.BetaParameter.ActualName = BetaParameterName;
    113       linearScaler.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameterName;
     125      linearScaler.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
    114126      linearScaler.ScaledSymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName;
    115127
    116       validationMseEvaluator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
    117       validationMseEvaluator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     128      validationMseEvaluator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     129      validationMseEvaluator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
    118130      validationMseEvaluator.SymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName;
    119       validationMseEvaluator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameterName;
     131      validationMseEvaluator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
    120132      validationMseEvaluator.QualityParameter.ActualName = QualityParameterName;
    121       validationMseEvaluator.RegressionProblemDataParameter.ActualName = ProblemDataParameterName;
    122       validationMseEvaluator.SamplesStartParameter.ActualName = SamplesStartParameterName;
    123       validationMseEvaluator.SamplesEndParameter.ActualName = SamplesEndParameterName;
    124 
    125       bestSolutionAnalyzer.BestSolutionParameter.ActualName = BestSolutionParameterName;
    126       bestSolutionAnalyzer.BestSolutionQualityParameter.ActualName = BestSolutionQualityParameterName;
    127       bestSolutionAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
    128       bestSolutionAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameterName;
     133      validationMseEvaluator.RegressionProblemDataParameter.ActualName = ProblemDataParameter.Name;
     134      validationMseEvaluator.SamplesStartParameter.ActualName = SamplesStartParameter.Name;
     135      validationMseEvaluator.SamplesEndParameter.ActualName = SamplesEndParameter.Name;
     136
     137      bestSolutionAnalyzer.BestSolutionParameter.ActualName = BestSolutionParameter.Name;
     138      bestSolutionAnalyzer.BestSolutionQualityParameter.ActualName = BestSolutionQualityParameter.Name;
     139      bestSolutionAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     140      bestSolutionAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
    129141      bestSolutionAnalyzer.QualityParameter.ActualName = QualityParameterName;
    130       bestSolutionAnalyzer.ResultsParameter.ActualName = ResultsParameterName;
    131       bestSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameterName;
     142      bestSolutionAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;
     143      bestSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
    132144      bestSolutionAnalyzer.SymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName;
    133       bestSolutionAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     145      bestSolutionAnalyzer.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     146      bestSolutionAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
     147
     148      bestAvgWorstValidationQualityCalculator.AverageQualityParameter.ActualName = "Current Average Validation Quality";
     149      bestAvgWorstValidationQualityCalculator.BestQualityParameter.ActualName = "Current Best Validation Quality";
     150      bestAvgWorstValidationQualityCalculator.MaximizationParameter.Value = new BoolValue(false);
     151      bestAvgWorstValidationQualityCalculator.QualityParameter.ActualName = QualityParameterName;
     152      bestAvgWorstValidationQualityCalculator.WorstQualityParameter.ActualName = "Current Worst Validation Quality";
     153
     154      validationQualityMemorizer.BestQualityParameter.ActualName = "Best Validation Quality";
     155      validationQualityMemorizer.QualityParameter.ActualName = QualityParameterName;
     156      validationQualityMemorizer.QualityParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     157
     158      validationValuesCollector.DataTableParameter.ActualName = "Validation Qualities";
     159      validationValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Validation Quality", null, "Current Best Validation Quality"));
     160      validationValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Validation Quality", null, "Best Validation Quality"));
     161
     162      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Validation Quality", null, "Current Best Validation Quality"));
     163      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Validation Quality", null, "Best Validation Quality"));
     164      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Validation Qualities"));
     165      resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
    134166      #endregion
    135167
     
    140172      validationMseEvaluator.Successor = null;
    141173      subScopesProc.Successor = bestSolutionAnalyzer;
    142       bestSolutionAnalyzer.Successor = null;
     174      bestSolutionAnalyzer.Successor = bestAvgWorstValidationQualityCalculator;
     175      bestAvgWorstValidationQualityCalculator.Successor = validationQualityMemorizer;
     176      validationQualityMemorizer.Successor = validationValuesCollector;
     177      validationValuesCollector.Successor = resultsCollector;
     178      resultsCollector.Successor = null;
    143179      #endregion
     180
     181      Initialize();
     182    }
     183
     184    [StorableConstructor]
     185    private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base() { }
     186
     187    [StorableHook(HookType.AfterDeserialization)]
     188    private void Initialize() {
     189      SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged);
     190    }
     191
     192    public override IDeepCloneable Clone(Cloner cloner) {
     193      ValidationBestScaledSymbolicRegressionSolutionAnalyzer clone = (ValidationBestScaledSymbolicRegressionSolutionAnalyzer)base.Clone(cloner);
     194      clone.Initialize();
     195      return clone;
     196    }
     197
     198    private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) {
     199      validationQualityMemorizer.QualityParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     200      bestSolutionAnalyzer.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth;
    144201    }
    145202  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r3666 r3681  
    156156      get { return operators; }
    157157    }
    158     public IEnumerable<ISymbolicRegressionSolutionPopulationAnalyzer> Analyzers {
    159       get { return operators.OfType<ISymbolicRegressionSolutionPopulationAnalyzer>(); }
     158    public IEnumerable<ISymbolicRegressionAnalyzer> Analyzers {
     159      get { return operators.OfType<ISymbolicRegressionAnalyzer>(); }
    160160    }
    161161    public DoubleValue PunishmentFactor {
     
    356356      operators = new List<IOperator>();
    357357      operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
    358       operators.Add(new PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer());
    359       operators.Add(new PopulationMinAvgMaxTreeSizeAnalyzer());
    360       operators.Add(new PopulationSymbolicRegressionVariableFrequencyAnalyzer());
    361       operators.Add(new PopulationSymbolicRegressionModelQualityAnalyzer());
     358      operators.Add(new ValidationBestScaledSymbolicRegressionSolutionAnalyzer());
     359      operators.Add(new MinAvgMaxSymbolicExpressionTreeSizeAnalyzer());
     360      operators.Add(new SymbolicRegressionVariableFrequencyAnalyzer());
     361      operators.Add(new SymbolicRegressionModelQualityAnalyzer());
    362362      ParameterizeOperators();
    363363      ParameterizeAnalyzers();
     
    382382      foreach (var analyzer in Analyzers) {
    383383        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    384         var bestValidationSolutionAnalyzer = analyzer as PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer;
     384        var bestValidationSolutionAnalyzer = analyzer as ValidationBestScaledSymbolicRegressionSolutionAnalyzer;
    385385        if (bestValidationSolutionAnalyzer != null) {
    386386          bestValidationSolutionAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
     
    392392          bestValidationSolutionAnalyzer.SamplesEndParameter.Value = ValidationSamplesEnd;
    393393        }
    394         var varFreqAnalyzer = analyzer as PopulationSymbolicRegressionVariableFrequencyAnalyzer;
     394        var varFreqAnalyzer = analyzer as SymbolicRegressionVariableFrequencyAnalyzer;
    395395        if (varFreqAnalyzer != null) {
    396396          varFreqAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
    397397        }
    398         var modelQualityAnalyzer = analyzer as PopulationSymbolicRegressionModelQualityAnalyzer;
     398        var modelQualityAnalyzer = analyzer as SymbolicRegressionModelQualityAnalyzer;
    399399        if (modelQualityAnalyzer != null) {
    400400          modelQualityAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
     
    409409        }
    410410      }
    411       foreach (ISymbolicExpressionTreePopulationAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreePopulationAnalyzer>()) {
     411      foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {
    412412        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    413413      }
Note: See TracChangeset for help on using the changeset viewer.