Changeset 14801


Ignore:
Timestamp:
03/30/17 16:57:38 (5 years ago)
Author:
mkommend
Message:

#2672: Merged r14293,r14294,r14295,r14372,r14376,r14465 into stable.

Location:
stable
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ClassificationPerformanceMeasuresCalculator.cs

    r14186 r14801  
    2323using System.Collections.Generic;
    2424using HeuristicLab.Common;
    25 using HeuristicLab.Problems.DataAnalysis.OnlineCalculators;
    2625
    2726namespace HeuristicLab.Problems.DataAnalysis {
    28   public class ClassificationPerformanceMeasuresCalculator {
     27  public class ClassificationPerformanceMeasuresCalculator : DeepCloneable {
    2928
    3029    public ClassificationPerformanceMeasuresCalculator(string positiveClassName, double positiveClassValue) {
     
    3231      this.positiveClassValue = positiveClassValue;
    3332      Reset();
     33    }
     34
     35    protected ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator original, Cloner cloner)
     36      : base(original, cloner) {
     37      positiveClassName = original.positiveClassName;
     38      positiveClassValue = original.positiveClassValue;
     39      truePositiveCount = original.truePositiveCount;
     40      falsePositiveCount = original.falsePositiveCount;
     41      trueNegativeCount = original.trueNegativeCount;
     42      falseNegativeCount = original.falseNegativeCount;
     43      errorState = original.errorState;
     44    }
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new ClassificationPerformanceMeasuresCalculator(this, cloner);
    3447    }
    3548
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineAccuracyCalculator.cs

    r14186 r14801  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineAccuracyCalculator : IOnlineCalculator {
     27  public class OnlineAccuracyCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private int correctlyClassified;
     
    3838      Reset();
    3939    }
     40
     41    protected OnlineAccuracyCalculator(OnlineAccuracyCalculator original, Cloner cloner)
     42      : base(original, cloner) {
     43      correctlyClassified = original.correctlyClassified;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new OnlineAccuracyCalculator(this, cloner);
     50    }
     51
    4052
    4153    #region IOnlineCalculator Members
     
    90102      }
    91103    }
     104
    92105  }
    93106}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineBoundedMeanSquaredErrorCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineBoundedMeanSquaredErrorCalculator : IOnlineCalculator {
     27  public class OnlineBoundedMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator {
    2728
    2829    private double errorSum;
     
    3839
    3940
    40     public OnlineBoundedMeanSquaredErrorCalculator(double lowerBound, double upperbound) {
     41    public OnlineBoundedMeanSquaredErrorCalculator(double lowerBound, double upperBound) {
    4142      LowerBound = lowerBound;
    42       UpperBound = upperbound;
     43      UpperBound = upperBound;
    4344      Reset();
     45    }
     46
     47    protected OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator original, Cloner cloner)
     48      : base(original, cloner) {
     49      LowerBound = original.LowerBound;
     50      UpperBound = original.UpperBound;
     51      n = original.n;
     52      errorSum = original.errorSum;
     53      errorState = original.ErrorState;
     54    }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new OnlineBoundedMeanSquaredErrorCalculator(this, cloner);
    4457    }
    4558
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineCovarianceCalculator : IOnlineCalculator {
     27  public class OnlineCovarianceCalculator : DeepCloneable, IOnlineCalculator {
    2728
    2829    private double xMean, yMean, Cn;
     
    3637    public OnlineCovarianceCalculator() {
    3738      Reset();
     39    }
     40
     41    protected OnlineCovarianceCalculator(OnlineCovarianceCalculator original, Cloner cloner)
     42      : base(original, cloner) {
     43      Cn = original.Cn;
     44      xMean = original.xMean;
     45      yMean = original.yMean;
     46      n = original.n;
     47      errorState = original.errorState;
     48    }
     49
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new OnlineCovarianceCalculator(this, cloner);
    3852    }
    3953
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineDirectionalSymmetryCalculator.cs

    r14186 r14801  
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis {
    28   public class OnlineDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator {
     28  public class OnlineDirectionalSymmetryCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
    2929    private int n;
    3030    private int nCorrect;
     
    3939    public OnlineDirectionalSymmetryCalculator() {
    4040      Reset();
     41    }
     42
     43    protected OnlineDirectionalSymmetryCalculator(OnlineDirectionalSymmetryCalculator original, Cloner cloner = null)
     44      : base(original, cloner) {
     45      n = original.n;
     46      nCorrect = original.nCorrect;
     47      errorState = original.errorState;
     48    }
     49
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new OnlineDirectionalSymmetryCalculator(this, cloner);
    4152    }
    4253
     
    94105      return dsCalculator.DirectionalSymmetry;
    95106    }
    96    
     107
    97108    public static double Calculate(IEnumerable<double> startValues, IEnumerable<IEnumerable<double>> actualContinuations, IEnumerable<IEnumerable<double>> predictedContinuations, out OnlineCalculatorError errorState) {
    98109      IEnumerator<double> startValueEnumerator = startValues.GetEnumerator();
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs

    r14186 r14801  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineLinearScalingParameterCalculator {
     27  public class OnlineLinearScalingParameterCalculator : DeepCloneable {
    2828
    2929    /// <summary>
     
    5555    }
    5656
    57     private OnlineMeanAndVarianceCalculator targetMeanCalculator;
    58     private OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator;
    59     private OnlineCovarianceCalculator originalTargetCovarianceCalculator;
     57    private readonly OnlineMeanAndVarianceCalculator targetMeanCalculator;
     58    private readonly OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator;
     59    private readonly OnlineCovarianceCalculator originalTargetCovarianceCalculator;
    6060
    6161    public OnlineLinearScalingParameterCalculator() {
     
    6565      Reset();
    6666    }
     67
     68    protected OnlineLinearScalingParameterCalculator(OnlineLinearScalingParameterCalculator original, Cloner cloner)
     69      : base(original, cloner) {
     70      targetMeanCalculator = cloner.Clone(original.targetMeanCalculator);
     71      originalMeanAndVarianceCalculator = cloner.Clone(original.originalMeanAndVarianceCalculator);
     72      originalTargetCovarianceCalculator = cloner.Clone(original.originalTargetCovarianceCalculator);
     73      // do not reset the calculators here
     74    }
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      return new OnlineLinearScalingParameterCalculator(this, cloner);
     77    }
     78
    6779
    6880    public void Reset() {
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineMaxAbsoluteErrorCalculator : IOnlineCalculator {
     27  public class OnlineMaxAbsoluteErrorCalculator : DeepCloneable, IOnlineCalculator {
    2728
    2829    private double mae;
     
    3637    public OnlineMaxAbsoluteErrorCalculator() {
    3738      Reset();
     39    }
     40
     41    protected OnlineMaxAbsoluteErrorCalculator(OnlineMaxAbsoluteErrorCalculator original, Cloner cloner = null)
     42      : base(original, cloner) {
     43      mae = original.mae;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new OnlineMaxAbsoluteErrorCalculator(this, cloner);
    3849    }
    3950
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsoluteErrorCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineMeanAbsoluteErrorCalculator : IOnlineCalculator {
     27  public class OnlineMeanAbsoluteErrorCalculator : DeepCloneable, IOnlineCalculator {
    2728
    2829    private double sae;
     
    3637    public OnlineMeanAbsoluteErrorCalculator() {
    3738      Reset();
     39    }
     40
     41    protected OnlineMeanAbsoluteErrorCalculator(OnlineMeanAbsoluteErrorCalculator original, Cloner cloner = null)
     42      : base(original, cloner) {
     43      sae = original.sae;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new OnlineMeanAbsoluteErrorCalculator(this, cloner);
    3849    }
    3950
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs

    r14186 r14801  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineMeanAbsolutePercentageErrorCalculator : IOnlineCalculator {
     27  public class OnlineMeanAbsolutePercentageErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double sre;
     
    3737    public OnlineMeanAbsolutePercentageErrorCalculator() {
    3838      Reset();
     39    }
     40
     41    protected OnlineMeanAbsolutePercentageErrorCalculator(OnlineMeanAbsolutePercentageErrorCalculator original, Cloner cloner = null)
     42      : base(original, cloner) {
     43      sre = original.sre;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new OnlineMeanAbsolutePercentageErrorCalculator(this, cloner);
    3950    }
    4051
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs

    r14303 r14801  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324
    2425namespace HeuristicLab.Problems.DataAnalysis {
    25   public class OnlineMeanAndVarianceCalculator {
     26  public class OnlineMeanAndVarianceCalculator : DeepCloneable {
    2627
    2728    private double m_oldM, m_newM, m_oldS, m_newS;
     
    6465    public OnlineMeanAndVarianceCalculator() {
    6566      Reset();
     67    }
     68
     69    protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator original, Cloner cloner = null)
     70      : base(original, cloner) {
     71      m_oldS = original.m_oldS;
     72      m_oldM = original.m_oldM;
     73      m_newS = original.m_newS;
     74      m_newM = original.m_newM;
     75      n = original.n;
     76      errorState = original.errorState;
     77      varianceErrorState = original.varianceErrorState;
     78    }
     79    public override IDeepCloneable Clone(Cloner cloner) {
     80      return new OnlineMeanAndVarianceCalculator(this, cloner);
    6681    }
    6782
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanErrorCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineMeanErrorCalculator : IOnlineCalculator {
     27  public class OnlineMeanErrorCalculator : DeepCloneable, IOnlineCalculator {
    2728
    2829    private readonly OnlineMeanAndVarianceCalculator meanAndVarianceCalculator;
     
    3435      meanAndVarianceCalculator = new OnlineMeanAndVarianceCalculator();
    3536      Reset();
     37    }
     38
     39    protected OnlineMeanErrorCalculator(OnlineMeanErrorCalculator original, Cloner cloner)
     40      : base(original, cloner) {
     41      meanAndVarianceCalculator = cloner.Clone(original.meanAndVarianceCalculator);
     42    }
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new OnlineMeanErrorCalculator(this, cloner);
    3645    }
    3746
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineMeanSquaredErrorCalculator : IOnlineCalculator {
     27  public class OnlineMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator {
    2728
    2829    private double sse;
     
    3637    public OnlineMeanSquaredErrorCalculator() {
    3738      Reset();
     39    }
     40
     41    protected OnlineMeanSquaredErrorCalculator(OnlineMeanSquaredErrorCalculator original, Cloner cloner)
     42      : base(original, cloner) {
     43      sse = original.sse;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new OnlineMeanSquaredErrorCalculator(this, cloner);
    3849    }
    3950
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs

    r14303 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineNormalizedMeanSquaredErrorCalculator : IOnlineCalculator {
     27  public class OnlineNormalizedMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator {
    2728    private OnlineMeanAndVarianceCalculator meanSquaredErrorCalculator;
    2829    private OnlineMeanAndVarianceCalculator originalVarianceCalculator;
     
    4041      originalVarianceCalculator = new OnlineMeanAndVarianceCalculator();
    4142      Reset();
     43    }
     44
     45    protected OnlineNormalizedMeanSquaredErrorCalculator(OnlineNormalizedMeanSquaredErrorCalculator original, Cloner cloner)
     46      : base(original, cloner) {
     47      meanSquaredErrorCalculator = cloner.Clone(original.meanSquaredErrorCalculator);
     48      originalVarianceCalculator = cloner.Clone(original.originalVarianceCalculator);
     49    }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner);
    4252    }
    4353
     
    92102      }
    93103    }
     104
     105
    94106  }
    95107}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRCalculator.cs

    r14186 r14801  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlinePearsonsRCalculator : IOnlineCalculator {
     27  public class OnlinePearsonsRCalculator : DeepCloneable, IOnlineCalculator {
    2828    private OnlineCovarianceCalculator covCalculator = new OnlineCovarianceCalculator();
    2929    private OnlineMeanAndVarianceCalculator sxCalculator = new OnlineMeanAndVarianceCalculator();
     
    4646
    4747    public OnlinePearsonsRCalculator() { }
     48
     49    protected OnlinePearsonsRCalculator(OnlinePearsonsRCalculator original, Cloner cloner)
     50      : base(original, cloner) {
     51      covCalculator = cloner.Clone(original.covCalculator);
     52      sxCalculator = cloner.Clone(original.sxCalculator);
     53      syCalculator = cloner.Clone(original.syCalculator);
     54    }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new OnlinePearsonsRCalculator(this, cloner);
     57    }
    4858
    4959    #region IOnlineCalculator Members
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs

    r14186 r14801  
    2626namespace HeuristicLab.Problems.DataAnalysis {
    2727  [Obsolete("Use OnlinePearsonsRCalculator directly")]
    28   public class OnlinePearsonsRSquaredCalculator : IOnlineCalculator {
     28  public class OnlinePearsonsRSquaredCalculator : DeepCloneable, IOnlineCalculator {
    2929    private readonly OnlinePearsonsRCalculator rCalculator = new OnlinePearsonsRCalculator();
    3030
     
    3737
    3838    public OnlinePearsonsRSquaredCalculator() { }
     39
     40    protected OnlinePearsonsRSquaredCalculator(OnlinePearsonsRSquaredCalculator original, Cloner cloner)
     41      : base(original, cloner) {
     42      rCalculator = cloner.Clone(original.rCalculator);
     43    }
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new OnlinePearsonsRSquaredCalculator(this, cloner);
     46    }
    3947
    4048    #region IOnlineCalculator Members
     
    5967      return r * r;
    6068    }
     69
     70
    6171  }
    6272}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineTheilsUStatisticCalculator.cs

    r14186 r14801  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineTheilsUStatisticCalculator : IOnlineTimeSeriesCalculator {
    27     private OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator;
    28     private OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator;
     27  public class OnlineTheilsUStatisticCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
     28    private readonly OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator;
     29    private readonly OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator;
    2930
    3031    public double TheilsUStatistic {
     
    4344      unbiasedEstimatorMeanCalculator = new OnlineMeanAndVarianceCalculator();
    4445      Reset();
     46    }
     47
     48    protected OnlineTheilsUStatisticCalculator(OnlineTheilsUStatisticCalculator original, Cloner cloner)
     49      : base(original, cloner) {
     50      squaredErrorMeanCalculator = cloner.Clone(original.squaredErrorMeanCalculator);
     51      unbiasedEstimatorMeanCalculator = cloner.Clone(original.unbiasedEstimatorMeanCalculator);
     52    }
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new OnlineTheilsUStatisticCalculator(this, cloner);
    4555    }
    4656
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedDirectionalSymmetryCalculator.cs

    r14186 r14801  
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis {
    28   public class OnlineWeightedDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator {
     28  public class OnlineWeightedDirectionalSymmetryCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
    2929    private int n;
    3030    private double correctSum;
     
    4040    public OnlineWeightedDirectionalSymmetryCalculator() {
    4141      Reset();
     42    }
     43
     44    protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator original, Cloner cloner)
     45      : base(original, cloner) {
     46      n = original.n;
     47      correctSum = original.correctSum;
     48      incorrectSum = original.incorrectSum;
     49      errorState = original.errorState;
     50    }
     51
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new OnlineWeightedDirectionalSymmetryCalculator(this, cloner);
    4254    }
    4355
Note: See TracChangeset for help on using the changeset viewer.