Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationSolution.cs

    r4469 r4722  
    3535  [StorableClass]
    3636  public class SymbolicClassificationSolution : SymbolicRegressionSolution, IClassificationSolution {
    37     private SymbolicClassificationSolution() : base() { }
     37    public new ClassificationProblemData ProblemData {
     38      get { return (ClassificationProblemData)base.ProblemData; }
     39      set { base.ProblemData = value; }
     40    }
     41
     42    #region properties
     43    private List<double> optimalThresholds;
     44    private List<double> actualThresholds;
     45    public IEnumerable<double> Thresholds {
     46      get {
     47        if (actualThresholds == null) RecalculateEstimatedValues();
     48        return actualThresholds;
     49      }
     50      set {
     51        if (actualThresholds != null && actualThresholds.SequenceEqual(value))
     52          return;
     53        actualThresholds = new List<double>(value);
     54        OnThresholdsChanged();
     55      }
     56    }
     57
     58    public IEnumerable<double> EstimatedClassValues {
     59      get { return GetEstimatedClassValues(Enumerable.Range(0, ProblemData.Dataset.Rows)); }
     60    }
     61
     62    public IEnumerable<double> EstimatedTrainingClassValues {
     63      get { return GetEstimatedClassValues(ProblemData.TrainingIndizes); }
     64    }
     65
     66    public IEnumerable<double> EstimatedTestClassValues {
     67      get { return GetEstimatedClassValues(ProblemData.TestIndizes); }
     68    }
     69
     70    [StorableConstructor]
     71    protected SymbolicClassificationSolution(bool deserializing) : base(deserializing) { }
     72    protected SymbolicClassificationSolution(SymbolicClassificationSolution original, Cloner cloner) : base(original, cloner) { }
    3873    public SymbolicClassificationSolution(ClassificationProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)
    3974      : base(problemData, model, lowerEstimationLimit, upperEstimationLimit) {
    4075    }
    4176
    42     public new ClassificationProblemData ProblemData {
    43       get { return (ClassificationProblemData)base.ProblemData; }
    44       set { base.ProblemData = value; }
     77    public override IDeepCloneable Clone(Cloner cloner) {
     78      return new SymbolicClassificationSolution(this, cloner);
    4579    }
    4680
     
    114148    }
    115149
    116     #region properties
    117     private List<double> optimalThresholds;
    118     private List<double> actualThresholds;
    119     public IEnumerable<double> Thresholds {
    120       get {
    121         if (actualThresholds == null) RecalculateEstimatedValues();
    122         return actualThresholds;
    123       }
    124       set {
    125         if (actualThresholds != null && actualThresholds.SequenceEqual(value))
    126           return;
    127         actualThresholds = new List<double>(value);
    128         OnThresholdsChanged();
    129       }
    130     }
    131 
    132     public IEnumerable<double> EstimatedClassValues {
    133       get { return GetEstimatedClassValues(Enumerable.Range(0, ProblemData.Dataset.Rows)); }
    134     }
    135 
    136     public IEnumerable<double> EstimatedTrainingClassValues {
    137       get { return GetEstimatedClassValues(ProblemData.TrainingIndizes); }
    138     }
    139 
    140     public IEnumerable<double> EstimatedTestClassValues {
    141       get { return GetEstimatedClassValues(ProblemData.TestIndizes); }
    142     }
    143 
    144150    public IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows) {
    145151      double[] classValues = ProblemData.SortedClassValues.ToArray();
Note: See TracChangeset for help on using the changeset viewer.