- Timestamp:
- 04/20/10 15:49:22 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj
r3384 r3442 86 86 <Compile Include="HeuristicLabProblemsDataAnalysisRegressionPlugin.cs" /> 87 87 <Compile Include="Properties\AssemblyInfo.cs" /> 88 <Compile Include="Symbolic\BestValidationSymbolicRegressionSolutionVisualizer.cs" /> 89 <Compile Include="Symbolic\SymbolicRegressionSolution.cs" /> 90 <Compile Include="Symbolic\SymbolicRegressionModel.cs" /> 88 91 <Compile Include="Symbolic\ISymbolicRegressionEvaluator.cs"> 89 92 <SubType>Code</SubType> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
r3409 r3442 118 118 get { return EvaluatorParameter.Value; } 119 119 } 120 public ArithmeticExpressionGrammar FunctionTreeGrammar {121 get { return ( ArithmeticExpressionGrammar)FunctionTreeGrammarParameter.Value; }120 public ISymbolicExpressionGrammar FunctionTreeGrammar { 121 get { return (ISymbolicExpressionGrammar)FunctionTreeGrammarParameter.Value; } 122 122 } 123 123 public ISingleObjectiveSolutionsVisualizer Visualizer { … … 141 141 SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator(); 142 142 var evaluator = new SymbolicRegressionMeanSquaredErrorEvaluator(); 143 var grammar = new GlobalSymbolicExpressionGrammar(new ArithmeticExpressionGrammar()); 143 var grammar = new ArithmeticExpressionGrammar(); 144 var globalGrammar = new GlobalSymbolicExpressionGrammar(grammar); 145 var visualizer = new BestValidationSymbolicRegressionSolutionVisualizer(); 144 146 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", new BoolValue(false))); 145 147 Parameters.Add(new ValueParameter<SymbolicExpressionTreeCreator>("SolutionCreator", "The operator which should be used to create new symbolic regression solutions.", creator)); 146 148 Parameters.Add(new ValueParameter<ISymbolicRegressionEvaluator>("Evaluator", "The operator which should be used to evaluate symbolic regression solutions.", evaluator)); 147 149 Parameters.Add(new ValueParameter<DoubleValue>("BestKnownQuality", "The minimal error value that can be reached by symbolic regression models.", new DoubleValue(0))); 148 Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("FunctionTreeGrammar", "The grammar that should be used for symbolic regression models.", g rammar));150 Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("FunctionTreeGrammar", "The grammar that should be used for symbolic regression models.", globalGrammar)); 149 151 Parameters.Add(new ValueParameter<IntValue>("MaxExpressionLength", "Maximal length of the symbolic expression.", new IntValue(100))); 150 152 Parameters.Add(new ValueParameter<IntValue>("MaxExpressionDepth", "Maximal depth of the symbolic expression.", new IntValue(10))); … … 152 154 Parameters.Add(new ValueParameter<IntValue>("MaxFunctionArguments", "Maximal number of arguments of automatically defined functions.", new IntValue(3))); 153 155 Parameters.Add(new ValueParameter<DoubleValue>("NumberOfEvaluatedNodes", "The total number of evaluated function tree nodes (for performance measurements.)", new DoubleValue())); 154 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize artificial ant solutions.", null));156 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize symbolic regression solutions.", visualizer)); 155 157 156 158 creator.SymbolicExpressionTreeParameter.ActualName = "SymbolicRegressionModel"; 159 creator.MaxFunctionArgumentsParameter.ActualName = "MaxFunctionArguments"; 160 creator.MaxFunctionDefinitionsParameter.ActualName = "MaxFunctionDefiningBranches"; 157 161 evaluator.QualityParameter.ActualName = "TrainingMeanSquaredError"; 158 162 DataAnalysisProblemDataParameter.ValueChanged += new EventHandler(DataAnalysisProblemDataParameter_ValueChanged); 159 DataAnalysisProblemData. InputVariablesChanged += new EventHandler(DataAnalysisProblemData_InputVariablesChanged);163 DataAnalysisProblemData.ProblemDataChanged += new EventHandler(DataAnalysisProblemData_Changed); 160 164 ParameterizeSolutionCreator(); 161 165 ParameterizeEvaluator(); … … 166 170 167 171 void DataAnalysisProblemDataParameter_ValueChanged(object sender, EventArgs e) { 168 DataAnalysisProblemData.InputVariablesChanged += new EventHandler(DataAnalysisProblemData_InputVariablesChanged); 169 } 170 171 void DataAnalysisProblemData_InputVariablesChanged(object sender, EventArgs e) { 172 FunctionTreeGrammar.VariableNames = DataAnalysisProblemData.InputVariables.Select(x => x.Value); 172 DataAnalysisProblemData.ProblemDataChanged += new EventHandler(DataAnalysisProblemData_Changed); 173 } 174 175 void DataAnalysisProblemData_Changed(object sender, EventArgs e) { 176 foreach (var varSymbol in FunctionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable>()) { 177 varSymbol.VariableNames = DataAnalysisProblemData.InputVariables.Select(x => x.Value); 178 } 173 179 } 174 180 … … 268 274 private void ParameterizeVisualizer() { 269 275 if (Visualizer != null) { 270 //Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 271 //var antTrailVisualizer = Visualizer as IAntTrailVisualizer; 272 //if (antTrailVisualizer != null) { 273 // antTrailVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 274 // antTrailVisualizer.WorldParameter.ActualName = WorldParameter.Name; 275 // antTrailVisualizer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name; 276 //} 277 //var bestSymExpressionVisualizer = Visualizer as BestSymbolicExpressionTreeVisualizer; 278 //if (bestSymExpressionVisualizer != null) { 279 // bestSymExpressionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 280 //} 276 var solutionVisualizer = Visualizer as BestValidationSymbolicRegressionSolutionVisualizer; 277 if (solutionVisualizer != null) { 278 solutionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 279 solutionVisualizer.DataAnalysisProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name; 280 } 281 281 } 282 282 }
Note: See TracChangeset
for help on using the changeset viewer.