Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/10 14:17:07 (15 years ago)
Author:
gkronber
Message:

Fixed a bug in symbolic regression analyzers. (MSE, R² and relative errors were evaluated on the non-scaled solution). #938

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r3800 r3806  
    4949    private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
    5050    private const string ProblemDataParameterName = "ProblemData";
    51     private const string SamplesStartParameterName = "SamplesStart";
    52     private const string SamplesEndParameterName = "SamplesEnd";
     51    private const string TrainingSamplesStartParameterName = "TrainingSamplesStart";
     52    private const string TrainingSamplesEndParameterName = "TrainingSamplesEnd";
     53    private const string ValidationSamplesStartParameterName = "ValidationSamplesStart";
     54    private const string ValidationSamplesEndParameterName = "ValidationSamplesEnd";
     55    private const string TestSamplesStartParameterName = "TestSamplesStart";
     56    private const string TestSamplesEndParameterName = "TestSamplesEnd";
    5357    private const string QualityParameterName = "Quality";
    5458    private const string ScaledQualityParameterName = "ScaledQuality";
     
    7579      get { return (IValueLookupParameter<DataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
    7680    }
    77     public IValueLookupParameter<IntValue> SamplesStartParameter {
    78       get { return (IValueLookupParameter<IntValue>)Parameters[SamplesStartParameterName]; }
    79     }
    80     public IValueLookupParameter<IntValue> SamplesEndParameter {
    81       get { return (IValueLookupParameter<IntValue>)Parameters[SamplesEndParameterName]; }
     81    public IValueLookupParameter<IntValue> TrainingSamplesStartParameter {
     82      get { return (IValueLookupParameter<IntValue>)Parameters[TrainingSamplesStartParameterName]; }
     83    }
     84    public IValueLookupParameter<IntValue> TrainingSamplesEndParameter {
     85      get { return (IValueLookupParameter<IntValue>)Parameters[TrainingSamplesEndParameterName]; }
     86    }
     87    public IValueLookupParameter<IntValue> ValidationSamplesStartParameter {
     88      get { return (IValueLookupParameter<IntValue>)Parameters[ValidationSamplesStartParameterName]; }
     89    }
     90    public IValueLookupParameter<IntValue> ValidationSamplesEndParameter {
     91      get { return (IValueLookupParameter<IntValue>)Parameters[ValidationSamplesEndParameterName]; }
     92    }
     93    public IValueLookupParameter<IntValue> TestSamplesStartParameter {
     94      get { return (IValueLookupParameter<IntValue>)Parameters[TestSamplesStartParameterName]; }
     95    }
     96    public IValueLookupParameter<IntValue> TestSamplesEndParameter {
     97      get { return (IValueLookupParameter<IntValue>)Parameters[TestSamplesEndParameterName]; }
    8298    }
    8399    public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
     
    108124    [Storable]
    109125    private BestQualityMemorizer bestKnownQualityMemorizer;
     126    [Storable]
     127    private SymbolicRegressionModelQualityAnalyzer modelQualityAnalyzer;
    110128
    111129    public ValidationBestScaledSymbolicRegressionSolutionAnalyzer()
     
    115133      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used for the analysis of symbolic expression trees."));
    116134      Parameters.Add(new ValueLookupParameter<DataAnalysisProblemData>(ProblemDataParameterName, "The problem data for which the symbolic expression tree is a solution."));
    117       Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The first index of the validation partition of the data set."));
    118       Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The last index of the validation partition of the data set."));
     135      Parameters.Add(new ValueLookupParameter<IntValue>(TrainingSamplesStartParameterName, "The first index of the training partition of the data set."));
     136      Parameters.Add(new ValueLookupParameter<IntValue>(TrainingSamplesEndParameterName, "The last index of the training partition of the data set."));
     137      Parameters.Add(new ValueLookupParameter<IntValue>(ValidationSamplesStartParameterName, "The first index of the validation partition of the data set."));
     138      Parameters.Add(new ValueLookupParameter<IntValue>(ValidationSamplesEndParameterName, "The last index of the validation partition of the data set."));
     139      Parameters.Add(new ValueLookupParameter<IntValue>(TestSamplesStartParameterName, "The first index of the test partition of the data set."));
     140      Parameters.Add(new ValueLookupParameter<IntValue>(TestSamplesEndParameterName, "The last index of the test partition of the data set."));
    119141      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper estimation limit that was set for the evaluation of the symbolic expression trees."));
    120142      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
     
    127149      subScopesProcessor = new UniformSubScopesProcessor();
    128150      SymbolicRegressionSolutionLinearScaler linearScaler = new SymbolicRegressionSolutionLinearScaler();
     151      modelQualityAnalyzer = new SymbolicRegressionModelQualityAnalyzer();
    129152      SymbolicRegressionMeanSquaredErrorEvaluator validationMseEvaluator = new SymbolicRegressionMeanSquaredErrorEvaluator();
    130153      bestSolutionAnalyzer = new BestSymbolicRegressionSolutionAnalyzer();
     
    143166      linearScaler.ScaledSymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName;
    144167
     168      modelQualityAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
     169      modelQualityAnalyzer.SymbolicExpressionTreeParameter.ActualName = ScaledSymbolicExpressionTreeParameterName;
     170      modelQualityAnalyzer.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     171      modelQualityAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
     172      modelQualityAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     173      modelQualityAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
     174      modelQualityAnalyzer.TrainingSamplesStartParameter.ActualName = TrainingSamplesStartParameter.Name;
     175      modelQualityAnalyzer.TrainingSamplesEndParameter.ActualName = TrainingSamplesEndParameter.Name;
     176      modelQualityAnalyzer.TestSamplesStartParameter.ActualName = TestSamplesStartParameter.Name;
     177      modelQualityAnalyzer.TestSamplesEndParameter.ActualName = TestSamplesEndParameter.Name;
     178
    145179      validationMseEvaluator.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
    146180      validationMseEvaluator.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
     
    149183      validationMseEvaluator.QualityParameter.ActualName = ScaledQualityParameterName;
    150184      validationMseEvaluator.RegressionProblemDataParameter.ActualName = ProblemDataParameter.Name;
    151       validationMseEvaluator.SamplesStartParameter.ActualName = SamplesStartParameter.Name;
    152       validationMseEvaluator.SamplesEndParameter.ActualName = SamplesEndParameter.Name;
     185      validationMseEvaluator.SamplesStartParameter.ActualName = ValidationSamplesStartParameter.Name;
     186      validationMseEvaluator.SamplesEndParameter.ActualName = ValidationSamplesEndParameter.Name;
    153187
    154188      bestSolutionAnalyzer.BestSolutionParameter.ActualName = BestSolutionParameter.Name;
     
    190224      linearScaler.Successor = validationMseEvaluator;
    191225      validationMseEvaluator.Successor = null;
    192       subScopesProcessor.Successor = bestSolutionAnalyzer;
     226      subScopesProcessor.Successor = modelQualityAnalyzer;
     227      modelQualityAnalyzer.Successor = bestSolutionAnalyzer;
    193228      bestSolutionAnalyzer.Successor = bestAvgWorstValidationQualityCalculator;
    194229      bestAvgWorstValidationQualityCalculator.Successor = bestKnownQualityMemorizer;
     
    221256      bestAvgWorstValidationQualityCalculator.QualityParameter.Depth = SymbolicExpressionTreeParameter.Depth;
    222257      bestKnownQualityMemorizer.QualityParameter.Depth = SymbolicExpressionTreeParameter.Depth;
     258      modelQualityAnalyzer.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth;
    223259    }
    224260  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r3800 r3806  
    371371      operators.Add(new MinAvgMaxSymbolicExpressionTreeSizeAnalyzer());
    372372      operators.Add(new SymbolicRegressionVariableFrequencyAnalyzer());
    373       operators.Add(new SymbolicRegressionModelQualityAnalyzer());
    374373      ParameterizeOperators();
    375374      ParameterizeAnalyzers();
     
    401400          bestValidationSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
    402401          bestValidationSolutionAnalyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    403           bestValidationSolutionAnalyzer.SamplesStartParameter.Value = ValidationSamplesStart;
    404           bestValidationSolutionAnalyzer.SamplesEndParameter.Value = ValidationSamplesEnd;
     402          bestValidationSolutionAnalyzer.TrainingSamplesStartParameter.Value = TrainingSamplesStart;
     403          bestValidationSolutionAnalyzer.TrainingSamplesEndParameter.Value = TrainingSamplesEnd;
     404          bestValidationSolutionAnalyzer.ValidationSamplesStartParameter.Value = ValidationSamplesStart;
     405          bestValidationSolutionAnalyzer.ValidationSamplesEndParameter.Value = ValidationSamplesEnd;
     406          bestValidationSolutionAnalyzer.TestSamplesStartParameter.Value = TestSamplesStart;
     407          bestValidationSolutionAnalyzer.TestSamplesEndParameter.Value = TestSamplesEnd;
    405408          bestValidationSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
    406409          bestValidationSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     
    410413          varFreqAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
    411414        }
    412         var modelQualityAnalyzer = analyzer as SymbolicRegressionModelQualityAnalyzer;
    413         if (modelQualityAnalyzer != null) {
    414           modelQualityAnalyzer.ProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;
    415           modelQualityAnalyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    416           modelQualityAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
    417           modelQualityAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
    418           modelQualityAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
    419           modelQualityAnalyzer.TrainingSamplesStartParameter.Value = TrainingSamplesStart;
    420           modelQualityAnalyzer.TrainingSamplesEndParameter.Value = ValidationSamplesEnd;
    421           modelQualityAnalyzer.TestSamplesStartParameter.Value = TestSamplesStart;
    422           modelQualityAnalyzer.TestSamplesEndParameter.Value = TestSamplesEnd;
    423         }
    424415      }
    425416      foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {
Note: See TracChangeset for help on using the changeset viewer.