Changeset 3681
- Timestamp:
- 05/06/10 19:02:45 (15 years ago)
- 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 32 32 using HeuristicLab.Analysis; 33 33 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces; 34 using System; 34 35 35 36 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers { 36 37 /// <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. 38 39 /// </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.")] 40 41 [StorableClass] 41 public sealed class PopulationMinAvgMaxTreeSizeAnalyzer : AlgorithmOperator, ISymbolicExpressionTreePopulationAnalyzer {42 public sealed class MinAvgMaxSymbolicExpressionTreeSizeAnalyzer : AlgorithmOperator, ISymbolicExpressionTreeAnalyzer { 42 43 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 43 44 private const string SymbolicExpressionTreeSizeParameterName = "SymbolicExpressionTreeSize"; … … 45 46 private const string ResultsParameterName = "Results"; 46 47 47 48 48 #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]; } 51 51 } 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]; } 54 54 } 55 55 public ValueLookupParameter<DataTable> SymbolicExpressionTreeSizesParameter { … … 59 59 get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; } 60 60 } 61 62 [Storable] 63 private MinAverageMaxValueAnalyzer valueAnalyzer; 64 61 65 #endregion 62 public PopulationMinAvgMaxTreeSizeAnalyzer()66 public MinAvgMaxSymbolicExpressionTreeSizeAnalyzer() 63 67 : base() { 64 68 Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose size should be calculated.")); … … 69 73 UniformSubScopesProcessor subScopesProcessor = new UniformSubScopesProcessor(); 70 74 SymbolicExpressionTreeSizeCalculator sizeCalculator = new SymbolicExpressionTreeSizeCalculator(); 71 MinAverageMaxValueAnalyzer valuesAnalyzer = new MinAverageMaxValueAnalyzer();75 valueAnalyzer = new MinAverageMaxValueAnalyzer(); 72 76 sizeCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name; 73 77 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"; 80 85 81 86 OperatorGraph.InitialOperator = subScopesProcessor; 82 87 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; 85 110 } 86 111 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj
r3651 r3681 83 83 </ItemGroup> 84 84 <ItemGroup> 85 <Compile Include="Analyzers\PopulationMinAvgMaxTreeSizeAnalyzer.cs" /> 86 <Compile Include="Analyzers\SymbolicExpressionTreeSizeAnalyzer.cs" /> 85 <Compile Include="Analyzers\MinAvgMaxSymbolicExpressionTreeSizeAnalyzer.cs" /> 87 86 <Compile Include="Analyzers\SymbolicExpressionTreeSizeCalculator.cs" /> 88 87 <Compile Include="ArchitectureManipulators\ArgumentCreater.cs" /> … … 103 102 <Compile Include="Interfaces\ISymbolicExpressionTreeCreator.cs" /> 104 103 <Compile Include="Interfaces\ISymbolicExpressionTreeCrossover.cs" /> 105 <Compile Include="Interfaces\ISymbolicExpressionTreeMultiPopulationAnalyzer.cs" />106 <Compile Include="Interfaces\ISymbolicExpressionTreePopulationAnalyzer.cs" />107 104 <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" /> 108 105 <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" /> -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeAnalyzer.cs
r3658 r3681 35 35 /// </summary> 36 36 public interface ISymbolicExpressionTreeAnalyzer : IAnalyzer { 37 ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }37 ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; } 38 38 } 39 39 } -
trunk/sources/HeuristicLab.Problems.ArtificialAnt.Views/3.3/HeuristicLab.Problems.ArtificialAnt.Views-3.3.csproj
r3437 r3681 88 88 <DependentUpon>AntTrailView.cs</DependentUpon> 89 89 </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> 90 96 <Compile Include="HeuristicLabProblemsArtificialAntViewsPlugin.cs" /> 91 97 <Compile Include="Properties\AssemblyInfo.cs" /> … … 112 118 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 113 119 <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> 114 124 </ProjectReference> 115 125 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj"> … … 142 152 </ProjectReference> 143 153 </ItemGroup> 154 <ItemGroup> 155 <EmbeddedResource Include="AntTrailSymbolicExpressionTreeView.resx"> 156 <DependentUpon>AntTrailSymbolicExpressionTreeView.cs</DependentUpon> 157 </EmbeddedResource> 158 </ItemGroup> 144 159 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 145 160 <!-- 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 33 33 [PluginDependency("HeuristicLab.Data", "3.3.0.0")] 34 34 [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","3.3.0.0")] 35 [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views","3.3.0.0")] 35 36 [PluginDependency("HeuristicLab.MainForm", "3.3.0.0")] 36 37 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3.0.0")] -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Analyzers/BestAntTrailAnalyzer.cs
r3665 r3681 32 32 namespace HeuristicLab.Problems.ArtificialAnt.Analyzers { 33 33 /// <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. 35 35 /// </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.")] 37 37 [StorableClass] 38 public sealed class PopulationBestAntTrailAnalyzer : SingleSuccessorOperator, IAntTrailPopulationAnalyzer {38 public sealed class BestAntTrailAnalyzer : SingleSuccessorOperator, IAntTrailAnalyzer { 39 39 public ILookupParameter<BoolMatrix> WorldParameter { 40 40 get { return (ILookupParameter<BoolMatrix>)Parameters["World"]; } 41 41 } 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"]; } 44 44 } 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"]; } 47 47 } 48 48 public ILookupParameter<IntValue> MaxTimeStepsParameter { … … 56 56 } 57 57 58 public PopulationBestAntTrailAnalyzer()58 public BestAntTrailAnalyzer() 59 59 : base() { 60 60 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 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Data; 28 using HeuristicLab.Parameters; 28 29 29 30 namespace HeuristicLab.Problems.ArtificialAnt.Analyzers { 30 public interface IAntTrail PopulationAnalyzer : 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; } 33 34 ILookupParameter<BoolMatrix> WorldParameter { get; } 34 35 ILookupParameter<IntValue> MaxTimeStepsParameter { get; } -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs
r3651 r3681 188 188 } 189 189 190 public IEnumerable<IAntTrail PopulationAnalyzer> AntTrailAnalyzers {191 get { return operators.OfType<IAntTrail PopulationAnalyzer>(); }190 public IEnumerable<IAntTrailAnalyzer> AntTrailAnalyzers { 191 get { return operators.OfType<IAntTrailAnalyzer>(); } 192 192 } 193 193 #endregion … … 299 299 operators = new List<IOperator>(); 300 300 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()); 303 303 ParameterizeAnalyzers(); 304 304 ParameterizeOperators(); … … 316 316 } 317 317 private void ParameterizeAnalyzers() { 318 foreach (IAntTrail PopulationAnalyzer analyzer in AntTrailAnalyzers) {318 foreach (IAntTrailAnalyzer analyzer in AntTrailAnalyzers) { 319 319 analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 320 320 analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; … … 322 322 analyzer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name; 323 323 } 324 foreach (ISymbolicExpressionTree PopulationAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreePopulationAnalyzer>()) {324 foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) { 325 325 analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 326 326 } -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLab.Problems.ArtificialAnt-3.3.csproj
r3631 r3681 81 81 </ItemGroup> 82 82 <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" /> 85 85 <Compile Include="AntInterpreter.cs" /> 86 86 <Compile Include="HeuristicLabProblemsArtificialAntPlugin.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj
r3666 r3681 86 86 <Compile Include="HeuristicLabProblemsDataAnalysisRegressionPlugin.cs" /> 87 87 <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" /> 88 91 <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" />92 92 <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" /> 95 95 <Compile Include="Symbolic\SimpleSymbolicRegressionEvaluator.cs" /> 96 96 <Compile Include="Symbolic\SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/BestSymbolicRegressionSolutionAnalyzer.cs
r3665 r3681 36 36 37 37 namespace 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.")] 39 39 [StorableClass] 40 public sealed class PopulationBestSymbolicRegressionSolutionAnalyzer : SingleSuccessorOperator, ISymbolicRegressionSolutionPopulationAnalyzer {40 public sealed class BestSymbolicRegressionSolutionAnalyzer : SingleSuccessorOperator, ISymbolicRegressionAnalyzer { 41 41 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 42 42 private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter"; … … 49 49 private const string ResultsParameterName = "Results"; 50 50 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]; } 53 56 } 54 public I LookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {55 get { return (I LookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }57 public IValueLookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter { 58 get { return (IValueLookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; } 56 59 } 57 public I LookupParameter<DataAnalysisProblemData> ProblemDataParameter {58 get { return (I LookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }60 public IValueLookupParameter<DataAnalysisProblemData> ProblemDataParameter { 61 get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; } 59 62 } 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]; } 62 65 } 63 public I LookupParameter<DoubleValue> UpperEstimationLimitParameter {64 get { return (I LookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }66 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 67 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 65 68 } 66 public I LookupParameter<DoubleValue> LowerEstimationLimitParameter {67 get { return (I LookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }69 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 70 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 68 71 } 69 72 public ILookupParameter<SymbolicRegressionSolution> BestSolutionParameter { … … 77 80 } 78 81 79 public PopulationBestSymbolicRegressionSolutionAnalyzer()82 public BestSymbolicRegressionSolutionAnalyzer() 80 83 : base() { 81 84 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.")); 86 89 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The qualities of the symbolic regression trees which should be analyzed.")); 87 90 Parameters.Add(new LookupParameter<SymbolicRegressionSolution>(BestSolutionParameterName, "The best symbolic regression solution.")); … … 103 106 SymbolicRegressionSolution solution = BestSolutionParameter.ActualValue; 104 107 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])); 106 109 solution = new SymbolicRegressionSolution(problemData, model, lowerEstimationLimit.Value, upperEstimationLimit.Value); 107 110 BestSolutionParameter.ActualValue = solution; 108 111 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()))); 110 114 } else { 111 115 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])); 113 117 solution = new SymbolicRegressionSolution(problemData, model, lowerEstimationLimit.Value, upperEstimationLimit.Value); 114 118 BestSolutionParameter.ActualValue = solution; 115 119 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()); 117 122 } 118 123 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/ISymbolicRegressionAnalyzer.cs
r3665 r3681 37 37 38 38 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers { 39 public interface ISymbolicRegression SolutionPopulationAnalyzer : IAnalyzer {40 ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { get; }39 public interface ISymbolicRegressionAnalyzer : IAnalyzer { 40 ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; } 41 41 ILookupParameter<ResultCollection> ResultsParameter { get; } 42 42 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityAnalyzer.cs
r3666 r3681 37 37 using HeuristicLab.Problems.DataAnalysis.Evaluators; 38 38 using HeuristicLab.Optimization.Operators; 39 using System; 39 40 40 41 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers { … … 42 43 /// "An operator for analyzing the quality of symbolic regression solutions symbolic expression tree encoding." 43 44 /// </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.")] 45 46 [StorableClass] 46 public sealed class PopulationSymbolicRegressionModelQualityAnalyzer : AlgorithmOperator, ISymbolicRegressionSolutionPopulationAnalyzer {47 public sealed class SymbolicRegressionModelQualityAnalyzer : AlgorithmOperator, ISymbolicRegressionAnalyzer { 47 48 private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter"; 48 49 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; … … 54 55 private const string MaxTrainingMeanSquaredErrorQualityParameterName = "MaxTrainingMeanSquaredError"; 55 56 private const string AverageTrainingMeanSquaredErrorQualityParameterName = "AverageTrainingMeanSquaredError"; 57 private const string BestTrainingMeanSquaredErrorQualityParameterName = "BestTrainingMeanSquaredError"; 56 58 57 59 private const string TrainingAverageRelativeErrorQualityParameterName = "TrainingAverageRelativeError"; … … 59 61 private const string MaxTrainingAverageRelativeErrorQualityParameterName = "MaxTrainingAverageRelativeError"; 60 62 private const string AverageTrainingAverageRelativeErrorQualityParameterName = "AverageTrainingAverageRelativeError"; 63 private const string BestTrainingAverageRelativeErrorQualityParameterName = "BestTrainingAverageRelativeError"; 61 64 62 65 private const string TrainingRSquaredQualityParameterName = "TrainingRSquared"; … … 64 67 private const string MaxTrainingRSquaredQualityParameterName = "MaxTrainingRSquared"; 65 68 private const string AverageTrainingRSquaredQualityParameterName = "AverageTrainingRSquared"; 69 private const string BestTrainingRSquaredQualityParameterName = "BestTrainingRSquared"; 66 70 67 71 private const string TestMeanSquaredErrorQualityParameterName = "TestMeanSquaredError"; … … 69 73 private const string MaxTestMeanSquaredErrorQualityParameterName = "MaxTestMeanSquaredError"; 70 74 private const string AverageTestMeanSquaredErrorQualityParameterName = "AverageTestMeanSquaredError"; 75 private const string BestTestMeanSquaredErrorQualityParameterName = "BestTestMeanSquaredError"; 71 76 72 77 private const string TestAverageRelativeErrorQualityParameterName = "TestAverageRelativeError"; … … 74 79 private const string MaxTestAverageRelativeErrorQualityParameterName = "MaxTestAverageRelativeError"; 75 80 private const string AverageTestAverageRelativeErrorQualityParameterName = "AverageTestAverageRelativeError"; 81 private const string BestTestAverageRelativeErrorQualityParameterName = "BestTestAverageRelativeError"; 76 82 77 83 private const string TestRSquaredQualityParameterName = "TestRSquared"; … … 79 85 private const string MaxTestRSquaredQualityParameterName = "MaxTestRSquared"; 80 86 private const string AverageTestRSquaredQualityParameterName = "AverageTestRSquared"; 87 private const string BestTestRSquaredQualityParameterName = "BestTestRSquared"; 81 88 82 89 private const string RSquaredValuesParameterName = "R-squared Values"; … … 92 99 93 100 #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]; } 102 127 } 103 128 public ILookupParameter<ResultCollection> ResultsParameter { 104 129 get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; } 105 130 } 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 }124 131 #endregion 125 132 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() 127 147 : base() { 128 Parameters.Add(new LookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic expression tree."));129 148 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.")); 132 151 Parameters.Add(new ValueLookupParameter<IntValue>(TrainingSamplesStartParameterName, "The first index of the training data set partition on which the model quality values should be calculated.")); 133 152 Parameters.Add(new ValueLookupParameter<IntValue>(TrainingSamplesEndParameterName, "The last index of the training data set partition on which the model quality values should be calculated.")); … … 136 155 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.")); 137 156 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.")); 141 161 142 162 #region operator initialization … … 145 165 SymbolicRegressionModelQualityCalculator trainingQualityCalculator = new SymbolicRegressionModelQualityCalculator(); 146 166 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(); 157 175 #endregion 158 176 159 177 #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; 167 185 trainingQualityCalculator.AverageRelativeErrorQualityParameter.ActualName = TrainingAverageRelativeErrorQualityParameterName; 168 186 trainingQualityCalculator.MeanSquaredErrorQualityParameter.ActualName = TrainingMeanSquaredErrorQualityParameterName; 169 187 trainingQualityCalculator.RSquaredQualityParameter.ActualName = TrainingRSquaredQualityParameterName; 170 188 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; 178 196 testQualityCalculator.AverageRelativeErrorQualityParameter.ActualName = TestAverageRelativeErrorQualityParameterName; 179 197 testQualityCalculator.MeanSquaredErrorQualityParameter.ActualName = TestMeanSquaredErrorQualityParameterName; 180 198 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 245 250 #endregion 246 251 … … 250 255 trainingQualityCalculator.Successor = testQualityCalculator; 251 256 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; 264 290 } 265 291 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityCalculator.cs
r3666 r3681 57 57 58 58 #region parameter properties 59 public I LookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {60 get { return (I LookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }59 public IValueLookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter { 60 get { return (IValueLookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; } 61 61 } 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]; } 64 64 } 65 public I LookupParameter<DataAnalysisProblemData> ProblemDataParameter {66 get { return (I LookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }65 public IValueLookupParameter<DataAnalysisProblemData> ProblemDataParameter { 66 get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; } 67 67 } 68 68 public IValueLookupParameter<IntValue> SamplesStartParameter { … … 78 78 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 79 79 } 80 public I ValueLookupParameter<DoubleValue> RSquaredQualityParameter {81 get { return (I ValueLookupParameter<DoubleValue>)Parameters[RSQuaredQualityParameterName]; }80 public ILookupParameter<DoubleValue> RSquaredQualityParameter { 81 get { return (ILookupParameter<DoubleValue>)Parameters[RSQuaredQualityParameterName]; } 82 82 } 83 public I ValueLookupParameter<DoubleValue> AverageRelativeErrorQualityParameter {84 get { return (I ValueLookupParameter<DoubleValue>)Parameters[RelativeErrorQualityParameterName]; }83 public ILookupParameter<DoubleValue> AverageRelativeErrorQualityParameter { 84 get { return (ILookupParameter<DoubleValue>)Parameters[RelativeErrorQualityParameterName]; } 85 85 } 86 public I ValueLookupParameter<DoubleValue> MeanSquaredErrorQualityParameter {87 get { return (I ValueLookupParameter<DoubleValue>)Parameters[MeanSquaredErrorQualityParameterName]; }86 public ILookupParameter<DoubleValue> MeanSquaredErrorQualityParameter { 87 get { return (ILookupParameter<DoubleValue>)Parameters[MeanSquaredErrorQualityParameterName]; } 88 88 } 89 89 #endregion … … 91 91 public SymbolicRegressionModelQualityCalculator() 92 92 : 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 treesto 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.")); 96 96 Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The first index of the data set partition on which the model quality values should be calculated.")); 97 97 Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The first index of the data set partition on which the model quality values should be calculated.")); … … 107 107 SimpleMeanAbsolutePercentageErrorEvaluator simpleRelErrorEvaluator = new SimpleMeanAbsolutePercentageErrorEvaluator(); 108 108 SimpleMSEEvaluator simpleMseEvaluator = new SimpleMSEEvaluator(); 109 Assigner clearValues = new Assigner(); 109 110 #endregion 110 111 … … 127 128 simpleRelErrorEvaluator.ValuesParameter.ActualName = ValuesParameterName; 128 129 simpleRelErrorEvaluator.AverageRelativeErrorParameter.ActualName = AverageRelativeErrorQualityParameter.Name; 130 131 clearValues.LeftSideParameter.ActualName = ValuesParameterName; 132 clearValues.RightSideParameter.Value = new DoubleMatrix(); 129 133 #endregion 130 134 … … 134 138 simpleR2Evalator.Successor = simpleRelErrorEvaluator; 135 139 simpleRelErrorEvaluator.Successor = simpleMseEvaluator; 136 simpleMseEvaluator.Successor = null; 140 simpleMseEvaluator.Successor = clearValues; 141 clearValues.Successor = null; 137 142 #endregion 138 143 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionVariableFrequencyAnalyzer.cs
r3665 r3681 37 37 38 38 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers { 39 [Item(" PopulationSymbolicRegressionVariableFrequencyAnalyzer", "An operator for analyzing the variable frequencies in a populationof 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.")] 40 40 [StorableClass] 41 public sealed class PopulationSymbolicRegressionVariableFrequencyAnalyzer : SingleSuccessorOperator, ISymbolicRegressionSolutionPopulationAnalyzer {41 public sealed class SymbolicRegressionVariableFrequencyAnalyzer : SingleSuccessorOperator, ISymbolicRegressionAnalyzer { 42 42 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 43 43 private const string ProblemDataParameterName = "ProblemData"; … … 46 46 47 47 #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]; } 50 50 } 51 51 public ILookupParameter<DataTable> VariableFrequenciesParameter { … … 66 66 #endregion 67 67 68 public PopulationSymbolicRegressionVariableFrequencyAnalyzer()68 public SymbolicRegressionVariableFrequencyAnalyzer() 69 69 : base() { 70 70 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 34 34 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols; 35 35 using HeuristicLab.Problems.DataAnalysis; 36 using HeuristicLab.Analysis; 37 using System; 38 using HeuristicLab.Optimization.Operators; 36 39 37 40 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers { … … 39 42 /// An operator that analyzes the validation best scaled symbolic regression solution. 40 43 /// </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.")] 42 45 [StorableClass] 43 public sealed class PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer : AlgorithmOperator, ISymbolicRegressionSolutionPopulationAnalyzer {46 public sealed class ValidationBestScaledSymbolicRegressionSolutionAnalyzer : AlgorithmOperator, ISymbolicRegressionAnalyzer { 44 47 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 45 48 private const string ScaledSymbolicExpressionTreeParameterName = "ScaledSymbolicExpressionTree"; … … 57 60 private const string ResultsParameterName = "Results"; 58 61 59 public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter {60 get { return ( ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters[SymbolicExpressionTreeParameterName]; }61 } 62 public I LookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {63 get { return (I LookupParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }64 } 65 public I LookupParameter<DataAnalysisProblemData> ProblemDataParameter {66 get { return (I LookupParameter<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]; } 67 70 } 68 71 public IValueLookupParameter<IntValue> SamplesStartParameter { … … 72 75 get { return (IValueLookupParameter<IntValue>)Parameters[SamplesEndParameterName]; } 73 76 } 74 public I LookupParameter<DoubleValue> UpperEstimationLimitParameter {75 get { return (I LookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }76 } 77 public I LookupParameter<DoubleValue> LowerEstimationLimitParameter {78 get { return (I LookupParameter<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]; } 79 82 } 80 83 public ILookupParameter<SymbolicRegressionSolution> BestSolutionParameter { … … 88 91 } 89 92 90 public PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer() 93 [Storable] 94 private BestQualityMemorizer validationQualityMemorizer; 95 [Storable] 96 private BestSymbolicRegressionSolutionAnalyzer bestSolutionAnalyzer; 97 98 public ValidationBestScaledSymbolicRegressionSolutionAnalyzer() 91 99 : base() { 92 100 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.")); 95 103 Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The first index of the validation partition of the data set.")); 96 104 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.")); 99 107 Parameters.Add(new LookupParameter<SymbolicRegressionSolution>(BestSolutionParameterName, "The best symbolic regression solution.")); 100 108 Parameters.Add(new LookupParameter<DoubleValue>(BestSolutionQualityParameterName, "The quality of the best symbolic regression solution.")); … … 105 113 SymbolicRegressionSolutionLinearScaler linearScaler = new SymbolicRegressionSolutionLinearScaler(); 106 114 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(); 108 120 #endregion 109 121 … … 111 123 linearScaler.AlphaParameter.ActualName = AlphaParameterName; 112 124 linearScaler.BetaParameter.ActualName = BetaParameterName; 113 linearScaler.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter Name;125 linearScaler.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name; 114 126 linearScaler.ScaledSymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName; 115 127 116 validationMseEvaluator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter Name;117 validationMseEvaluator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter Name;128 validationMseEvaluator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name; 129 validationMseEvaluator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name; 118 130 validationMseEvaluator.SymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName; 119 validationMseEvaluator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter Name;131 validationMseEvaluator.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name; 120 132 validationMseEvaluator.QualityParameter.ActualName = QualityParameterName; 121 validationMseEvaluator.RegressionProblemDataParameter.ActualName = ProblemDataParameter Name;122 validationMseEvaluator.SamplesStartParameter.ActualName = SamplesStartParameter Name;123 validationMseEvaluator.SamplesEndParameter.ActualName = SamplesEndParameter Name;124 125 bestSolutionAnalyzer.BestSolutionParameter.ActualName = BestSolutionParameter Name;126 bestSolutionAnalyzer.BestSolutionQualityParameter.ActualName = BestSolutionQualityParameter Name;127 bestSolutionAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter Name;128 bestSolutionAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter Name;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; 129 141 bestSolutionAnalyzer.QualityParameter.ActualName = QualityParameterName; 130 bestSolutionAnalyzer.ResultsParameter.ActualName = ResultsParameter Name;131 bestSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter Name;142 bestSolutionAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name; 143 bestSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name; 132 144 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; 134 166 #endregion 135 167 … … 140 172 validationMseEvaluator.Successor = null; 141 173 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; 143 179 #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; 144 201 } 145 202 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
r3666 r3681 156 156 get { return operators; } 157 157 } 158 public IEnumerable<ISymbolicRegression SolutionPopulationAnalyzer> Analyzers {159 get { return operators.OfType<ISymbolicRegression SolutionPopulationAnalyzer>(); }158 public IEnumerable<ISymbolicRegressionAnalyzer> Analyzers { 159 get { return operators.OfType<ISymbolicRegressionAnalyzer>(); } 160 160 } 161 161 public DoubleValue PunishmentFactor { … … 356 356 operators = new List<IOperator>(); 357 357 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()); 362 362 ParameterizeOperators(); 363 363 ParameterizeAnalyzers(); … … 382 382 foreach (var analyzer in Analyzers) { 383 383 analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 384 var bestValidationSolutionAnalyzer = analyzer as PopulationValidationBestScaledSymbolicRegressionSolutionAnalyzer;384 var bestValidationSolutionAnalyzer = analyzer as ValidationBestScaledSymbolicRegressionSolutionAnalyzer; 385 385 if (bestValidationSolutionAnalyzer != null) { 386 386 bestValidationSolutionAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name; … … 392 392 bestValidationSolutionAnalyzer.SamplesEndParameter.Value = ValidationSamplesEnd; 393 393 } 394 var varFreqAnalyzer = analyzer as PopulationSymbolicRegressionVariableFrequencyAnalyzer;394 var varFreqAnalyzer = analyzer as SymbolicRegressionVariableFrequencyAnalyzer; 395 395 if (varFreqAnalyzer != null) { 396 396 varFreqAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name; 397 397 } 398 var modelQualityAnalyzer = analyzer as PopulationSymbolicRegressionModelQualityAnalyzer;398 var modelQualityAnalyzer = analyzer as SymbolicRegressionModelQualityAnalyzer; 399 399 if (modelQualityAnalyzer != null) { 400 400 modelQualityAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name; … … 409 409 } 410 410 } 411 foreach (ISymbolicExpressionTree PopulationAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreePopulationAnalyzer>()) {411 foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) { 412 412 analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 413 413 }
Note: See TracChangeset
for help on using the changeset viewer.