Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/10 15:49:22 (15 years ago)
Author:
gkronber
Message:

Implemented views for DataAnalysisProblems and DataAnalysisSolutions. #938 (Data types and operators for regression problems)

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  
    8686    <Compile Include="HeuristicLabProblemsDataAnalysisRegressionPlugin.cs" />
    8787    <Compile Include="Properties\AssemblyInfo.cs" />
     88    <Compile Include="Symbolic\BestValidationSymbolicRegressionSolutionVisualizer.cs" />
     89    <Compile Include="Symbolic\SymbolicRegressionSolution.cs" />
     90    <Compile Include="Symbolic\SymbolicRegressionModel.cs" />
    8891    <Compile Include="Symbolic\ISymbolicRegressionEvaluator.cs">
    8992      <SubType>Code</SubType>
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r3409 r3442  
    118118      get { return EvaluatorParameter.Value; }
    119119    }
    120     public ArithmeticExpressionGrammar FunctionTreeGrammar {
    121       get { return (ArithmeticExpressionGrammar)FunctionTreeGrammarParameter.Value; }
     120    public ISymbolicExpressionGrammar FunctionTreeGrammar {
     121      get { return (ISymbolicExpressionGrammar)FunctionTreeGrammarParameter.Value; }
    122122    }
    123123    public ISingleObjectiveSolutionsVisualizer Visualizer {
     
    141141      SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();
    142142      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();
    144146      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", new BoolValue(false)));
    145147      Parameters.Add(new ValueParameter<SymbolicExpressionTreeCreator>("SolutionCreator", "The operator which should be used to create new symbolic regression solutions.", creator));
    146148      Parameters.Add(new ValueParameter<ISymbolicRegressionEvaluator>("Evaluator", "The operator which should be used to evaluate symbolic regression solutions.", evaluator));
    147149      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.", grammar));
     150      Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("FunctionTreeGrammar", "The grammar that should be used for symbolic regression models.", globalGrammar));
    149151      Parameters.Add(new ValueParameter<IntValue>("MaxExpressionLength", "Maximal length of the symbolic expression.", new IntValue(100)));
    150152      Parameters.Add(new ValueParameter<IntValue>("MaxExpressionDepth", "Maximal depth of the symbolic expression.", new IntValue(10)));
     
    152154      Parameters.Add(new ValueParameter<IntValue>("MaxFunctionArguments", "Maximal number of arguments of automatically defined functions.", new IntValue(3)));
    153155      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));
    155157
    156158      creator.SymbolicExpressionTreeParameter.ActualName = "SymbolicRegressionModel";
     159      creator.MaxFunctionArgumentsParameter.ActualName = "MaxFunctionArguments";
     160      creator.MaxFunctionDefinitionsParameter.ActualName = "MaxFunctionDefiningBranches";
    157161      evaluator.QualityParameter.ActualName = "TrainingMeanSquaredError";
    158162      DataAnalysisProblemDataParameter.ValueChanged += new EventHandler(DataAnalysisProblemDataParameter_ValueChanged);
    159       DataAnalysisProblemData.InputVariablesChanged += new EventHandler(DataAnalysisProblemData_InputVariablesChanged);
     163      DataAnalysisProblemData.ProblemDataChanged += new EventHandler(DataAnalysisProblemData_Changed);
    160164      ParameterizeSolutionCreator();
    161165      ParameterizeEvaluator();
     
    166170
    167171    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      }
    173179    }
    174180
     
    268274    private void ParameterizeVisualizer() {
    269275      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        }
    281281      }
    282282    }
Note: See TracChangeset for help on using the changeset viewer.