Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5271 for trunk


Ignore:
Timestamp:
01/11/11 13:01:56 (13 years ago)
Author:
gkronber
Message:

Added training best solution analyzer for classification problems. #1369

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/HeuristicLab.Problems.DataAnalysis.Classification-3.3.csproj

    r5163 r5271  
    1212    <AssemblyName>HeuristicLab.Problems.DataAnalysis.Classification-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    14     <TargetFrameworkProfile></TargetFrameworkProfile>
     14    <TargetFrameworkProfile>
     15    </TargetFrameworkProfile>
    1516    <FileAlignment>512</FileAlignment>
    1617    <TargetFrameworkProfile />
     
    117118    <Compile Include="Properties\AssemblyInfo.cs" />
    118119    <Compile Include="Interfaces\ISymbolicClassificationAnalyzer.cs" />
     120    <Compile Include="Symbolic\Analyzer\TrainingBestSymbolicClassificationSolutionAnalyzer.cs" />
    119121    <Compile Include="Symbolic\Analyzer\ValidationBestSymbolicClassificationSolutionAnalyzer.cs" />
    120122    <Compile Include="Symbolic\Evaluators\OnlineAccuracyEvaluator.cs" />
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/Analyzer/ValidationBestSymbolicClassificationSolutionAnalyzer.cs

    r4837 r5271  
    5252    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    5353    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     54    private const string CalculateSolutionComplexityParameterName = "CalculateSolutionComplexity";
    5455
    5556    private const string ResultsParameterName = "Results";
     
    5859    private const string BestSolutionAccuracyTrainingParameterName = "Best solution accuracy (training)";
    5960    private const string BestSolutionAccuracyTestParameterName = "Best solution accuracy (test)";
     61    private const string BestSolutionLengthParameterName = "Best solution length (validation)";
     62    private const string BestSolutionHeightParameterName = "Best solution height (validiation)";
    6063    private const string VariableFrequenciesParameterName = "VariableFrequencies";
    6164
     
    101104      get { return (ILookupParameter<DataTable>)Parameters[VariableFrequenciesParameterName]; }
    102105    }
    103 
     106    public IValueParameter<BoolValue> CalculateSolutionComplexityParameter {
     107      get { return (IValueParameter<BoolValue>)Parameters[CalculateSolutionComplexityParameterName]; }
     108    }
    104109    public ILookupParameter<ResultCollection> ResultsParameter {
    105110      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
     
    116121    public ILookupParameter<DoubleValue> BestSolutionAccuracyTestParameter {
    117122      get { return (ILookupParameter<DoubleValue>)Parameters[BestSolutionAccuracyTestParameterName]; }
     123    }
     124    public ILookupParameter<IntValue> BestSolutionLengthParameter {
     125      get { return (ILookupParameter<IntValue>)Parameters[BestSolutionLengthParameterName]; }
     126    }
     127    public ILookupParameter<IntValue> BestSolutionHeightParameter {
     128      get { return (ILookupParameter<IntValue>)Parameters[BestSolutionHeightParameterName]; }
    118129    }
    119130    #endregion
     
    159170      get { return VariableFrequenciesParameter.ActualValue; }
    160171    }
     172    public BoolValue CalculateSolutionComplexity {
     173      get { return CalculateSolutionComplexityParameter.Value; }
     174      set { CalculateSolutionComplexityParameter.Value = value; }
     175    }
    161176
    162177    public ResultCollection Results {
     
    178193      get { return BestSolutionAccuracyTestParameter.ActualValue; }
    179194      protected set { BestSolutionAccuracyTestParameter.ActualValue = value; }
     195    }
     196    public IntValue BestSolutionLength {
     197      get { return BestSolutionLengthParameter.ActualValue; }
     198      set { BestSolutionLengthParameter.ActualValue = value; }
     199    }
     200    public IntValue BestSolutionHeight {
     201      get { return BestSolutionHeightParameter.ActualValue; }
     202      set { BestSolutionHeightParameter.ActualValue = value; }
    180203    }
    181204    #endregion
     
    202225      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
    203226      Parameters.Add(new LookupParameter<DataTable>(VariableFrequenciesParameterName, "The variable frequencies table to use for the calculation of variable impacts"));
    204 
     227      Parameters.Add(new ValueParameter<BoolValue>(CalculateSolutionComplexityParameterName, "Determines if the length and height of the validation best solution should be calculated.", new BoolValue(true)));
    205228      Parameters.Add(new ValueLookupParameter<ResultCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));
    206229      Parameters.Add(new LookupParameter<DoubleValue>(BestValidationQualityParameterName, "The validation quality of the best solution in the current run."));
     
    208231      Parameters.Add(new LookupParameter<DoubleValue>(BestSolutionAccuracyTrainingParameterName, "The training accuracy of the best solution."));
    209232      Parameters.Add(new LookupParameter<DoubleValue>(BestSolutionAccuracyTestParameterName, "The test accuracy of the best solution."));
     233      Parameters.Add(new LookupParameter<IntValue>(BestSolutionLengthParameterName, "The length of the best symbolic classification solution."));
     234      Parameters.Add(new LookupParameter<IntValue>(BestSolutionHeightParameterName, "The height of the best symbolic classification solution."));
     235    }
     236
     237    [StorableHook(HookType.AfterDeserialization)]
     238    private void AfterDeserialization() {
     239      if (!Parameters.ContainsKey(CalculateSolutionComplexityParameterName)) {
     240        Parameters.Add(new ValueParameter<BoolValue>(CalculateSolutionComplexityParameterName, "Determines if the length and height of the validation best solution should be calculated.", new BoolValue(true)));
     241      }
     242      if (!Parameters.ContainsKey(BestSolutionLengthParameterName)) {
     243        Parameters.Add(new LookupParameter<IntValue>(BestSolutionLengthParameterName, "The length of the best symbolic classification solution."));
     244      }
     245      if (!Parameters.ContainsKey(BestSolutionHeightParameterName)) {
     246        Parameters.Add(new LookupParameter<IntValue>(BestSolutionHeightParameterName, "The height of the best symbolic classification solution."));
     247      }
    210248    }
    211249
     
    278316
    279317    private void UpdateBestSolutionResults() {
     318      if (CalculateSolutionComplexity.Value) {
     319        BestSolutionLength = new IntValue(BestValidationSolution.Model.SymbolicExpressionTree.Size);
     320        BestSolutionHeight = new IntValue(BestValidationSolution.Model.SymbolicExpressionTree.Height);
     321        if (!Results.ContainsKey(BestSolutionLengthParameterName)) {
     322          Results.Add(new Result(BestSolutionLengthParameterName, "Length of the best solution on the validation set", new IntValue()));
     323          Results.Add(new Result(BestSolutionHeightParameterName, "Height of the best solution on the validation set", new IntValue()));
     324        }
     325        Results[BestSolutionLengthParameterName].Value = BestSolutionLength;
     326        Results[BestSolutionHeightParameterName].Value = BestSolutionHeight;
     327      }
     328
    280329      BestSymbolicRegressionSolutionAnalyzer.UpdateBestSolutionResults(BestValidationSolution, ClassificationProblemData, Results, Generations, VariableFrequencies);
    281330
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationProblem.cs

    r5118 r5271  
    237237      Operators.Add(new SymbolicRegressionVariableFrequencyAnalyzer());
    238238      Operators.Add(new ValidationBestSymbolicClassificationSolutionAnalyzer());
     239      Operators.Add(new TrainingBestSymbolicClassificationSolutionAnalyzer());
    239240    }
    240241
     
    314315          bestValidationSolutionAnalyzer.ValidationSamplesEndParameter.Value = ValidationSamplesEnd;
    315316        }
     317        var bestTrainingSolutionAnalyzer = analyzer as TrainingBestSymbolicClassificationSolutionAnalyzer;
     318        if (bestTrainingSolutionAnalyzer != null) {
     319          bestTrainingSolutionAnalyzer.ProblemDataParameter.ActualName = ClassificationProblemDataParameter.Name;
     320          bestTrainingSolutionAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
     321          bestTrainingSolutionAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     322          bestTrainingSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
     323          bestTrainingSolutionAnalyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     324        }
    316325        var varFreqAnalyzer = analyzer as SymbolicRegressionVariableFrequencyAnalyzer;
    317326        if (varFreqAnalyzer != null) {
Note: See TracChangeset for help on using the changeset viewer.