Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 19:26:56 (14 years ago)
Author:
gkronber
Message:

Refactored cloning in DataAnalysis plugins. #922

Location:
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/BestSupportVectorRegressionSolutionAnalyzer.cs

    r4543 r4678  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    5253    #endregion
    5354
     55    [StorableConstructor]
     56    private BestSupportVectorRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     57    private BestSupportVectorRegressionSolutionAnalyzer(BestSupportVectorRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    5458    public BestSupportVectorRegressionSolutionAnalyzer()
    5559      : base() {
    5660      Parameters.Add(new ScopeTreeLookupParameter<SupportVectorMachineModel>(SupportVectorRegressionModelParameterName, "The support vector regression models to analyze."));
    5761      Parameters.Add(new LookupParameter<SupportVectorRegressionSolution>(BestSolutionParameterName, "The best support vector regression solution."));
     62    }
     63
     64    public override IDeepCloneable Clone(Cloner cloner) {
     65      return new BestSupportVectorRegressionSolutionAnalyzer(this, cloner);
    5866    }
    5967
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs

    r4543 r4678  
    2424using System.Drawing;
    2525using System.Linq;
     26using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3637  [StorableClass]
    3738  public sealed class SupportVectorRegressionSolution : DataAnalysisSolution {
    38     public SupportVectorRegressionSolution() : base() { }
    39     public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)
    40       : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
    41       this.Model = model;
    42     }
    43 
    4439    public override Image ItemImage {
    4540      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Function; }
     
    5348    public Dataset SupportVectors {
    5449      get { return CalculateSupportVectors(); }
     50    }
     51
     52    private List<double> estimatedValues;
     53    public override IEnumerable<double> EstimatedValues {
     54      get {
     55        if (estimatedValues == null) RecalculateEstimatedValues();
     56        return estimatedValues;
     57      }
     58    }
     59
     60    public override IEnumerable<double> EstimatedTrainingValues {
     61      get {
     62        return GetEstimatedValues(ProblemData.TrainingIndizes);
     63      }
     64    }
     65
     66    public override IEnumerable<double> EstimatedTestValues {
     67      get {
     68        return GetEstimatedValues(ProblemData.TestIndizes);
     69      }
     70    }
     71
     72    [StorableConstructor]
     73    private SupportVectorRegressionSolution(bool deserializing) : base(deserializing) { }
     74    private SupportVectorRegressionSolution(SupportVectorRegressionSolution original, Cloner cloner) : base(original, cloner) { }
     75    public SupportVectorRegressionSolution() : base() { }
     76    public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)
     77      : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
     78      this.Model = model;
     79    }
     80
     81    public override IDeepCloneable Clone(Cloner cloner) {
     82      return new SupportVectorRegressionSolution(this, cloner);
    5583    }
    5684
     
    83111    }
    84112
    85     private List<double> estimatedValues;
    86     public override IEnumerable<double> EstimatedValues {
    87       get {
    88         if (estimatedValues == null) RecalculateEstimatedValues();
    89         return estimatedValues;
    90       }
    91     }
    92 
    93     public override IEnumerable<double> EstimatedTrainingValues {
    94       get {
    95         return GetEstimatedValues(ProblemData.TrainingIndizes);
    96       }
    97     }
    98 
    99     public override IEnumerable<double> EstimatedTestValues {
    100       get {
    101         return GetEstimatedValues(ProblemData.TestIndizes);
    102       }
    103     }
    104113
    105114    private IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) {
Note: See TracChangeset for help on using the changeset viewer.