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/Symbolic/Evaluators
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionEvaluator.cs

    r4468 r4678  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    102103    #endregion
    103104
     105    [StorableConstructor]
     106    protected MultiObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     107    protected MultiObjectiveSymbolicRegressionEvaluator(MultiObjectiveSymbolicRegressionEvaluator original, Cloner cloner) : base(original, cloner) { }
    104108    public MultiObjectiveSymbolicRegressionEvaluator()
    105109      : base() {
     
    112116      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end index of the dataset partition on which the symbolic regression solution should be evaluated."));
    113117      Parameters.Add(new ValueParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index.", new PercentValue(1)));
    114     }
    115 
    116     [StorableConstructor]
    117     protected MultiObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
    118     [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)]
    119     private void AfterDeserialization() {
    120118    }
    121119
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator.cs

    r4166 r4678  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
     23using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Evaluators;
    3029using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3130using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
     
    3433  [Item("MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator", "Calculates the mean squared error and the number of variables of a symbolic regression solution.")]
    3534  [StorableClass]
    36   public class MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
     35  public sealed class MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
    3736    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    3837    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     
    5453    }
    5554    #endregion
     55    [StorableConstructor]
     56    private MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     57    private MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator original, Cloner cloner)
     58      : base(original, cloner) {
     59    }
    5660    public MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator()
    5761      : base() {
    5862      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees."));
    5963      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees."));
     64    }
     65
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      return new MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(this, cloner);
    6068    }
    6169
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4128 r4678  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
     23using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Evaluators;
    3029using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3130using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
     
    3433  [Item("MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator", "Calculates the correlation coefficient r² and the number of variables of a symbolic regression solution.")]
    3534  [StorableClass]
    36   public class MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
     35  public sealed class MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
    3736    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    3837    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     
    5453    }
    5554    #endregion
     55    [StorableConstructor]
     56    protected MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     57    protected MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)
     58      : base(original, cloner) {
     59    }
    5660    public MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator()
    5761      : base() {
    5862      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees."));
    5963      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees."));
     64    }
     65
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      return new MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(this, cloner);
    6068    }
    6169
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SingleObjectiveSymbolicRegressionEvaluator.cs

    r4468 r4678  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    115116    #endregion
    116117
     118    [StorableConstructor]
     119    protected SingleObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     120    protected SingleObjectiveSymbolicRegressionEvaluator(SingleObjectiveSymbolicRegressionEvaluator original, Cloner cloner)
     121      : base(original, cloner) {
     122    }
    117123    public SingleObjectiveSymbolicRegressionEvaluator()
    118124      : base() {
     
    129135    }
    130136
    131     [StorableConstructor]
    132     protected SingleObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     137
    133138    [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)]
    134139    private void AfterDeserialization() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionMeanSquaredErrorEvaluator.cs

    r4190 r4678  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Parameters;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using HeuristicLab.Problems.DataAnalysis.Evaluators;
     
    3534  public class SymbolicRegressionMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    3635
    37     public SymbolicRegressionMeanSquaredErrorEvaluator()
    38       : base() {
     36    [StorableConstructor]
     37    protected SymbolicRegressionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     38    protected SymbolicRegressionMeanSquaredErrorEvaluator(SymbolicRegressionMeanSquaredErrorEvaluator original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
     41    public SymbolicRegressionMeanSquaredErrorEvaluator() : base() { }
     42
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new SymbolicRegressionMeanSquaredErrorEvaluator(this, cloner);
    3945    }
    4046
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4190 r4678  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Parameters;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using HeuristicLab.Problems.DataAnalysis.Evaluators;
     
    3433  [StorableClass]
    3534  public class SymbolicRegressionPearsonsRSquaredEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    36     public SymbolicRegressionPearsonsRSquaredEvaluator()
    37       : base() {
     35    [StorableConstructor]
     36    protected SymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     37    protected SymbolicRegressionPearsonsRSquaredEvaluator(SymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)
     38      : base(original, cloner) {
    3839    }
     40    public SymbolicRegressionPearsonsRSquaredEvaluator() : base() { }
    3941
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new SymbolicRegressionPearsonsRSquaredEvaluator(this, cloner);
     44    }
    4045    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    4146      double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator.cs

    r4190 r4678  
    3434  [Item("SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator", "Calculates the mean and the variance of the squared errors of a linearly scaled symbolic regression solution.")]
    3535  [StorableClass]
    36   public class SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
     36  public sealed class SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
    3737    private const string QualityVarianceParameterName = "QualityVariance";
    3838    private const string QualitySamplesParameterName = "QualitySamples";
     
    9090    }
    9191    #endregion
     92    [StorableConstructor]
     93    private SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     94    private SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
    9295    public SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator()
    9396      : base() {
     
    100103      Parameters.Add(new LookupParameter<DoubleValue>(DecompositionVarianceParameterName, "A parameter which stores the relativ bias of the MSE."));
    101104      Parameters.Add(new LookupParameter<DoubleValue>(DecompositionCovarianceParameterName, "A parameter which stores the relativ bias of the MSE."));
     105    }
     106
     107    public override IDeepCloneable Clone(Cloner cloner) {
     108      return new SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(this, cloner);
    102109    }
    103110
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs

    r4477 r4678  
    3434  [Item("SymbolicRegressionScaledMeanSquaredErrorEvaluator", "Calculates the mean squared error of a linearly scaled symbolic regression solution.")]
    3535  [StorableClass]
    36   public class SymbolicRegressionScaledMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
     36  public sealed class SymbolicRegressionScaledMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
    3737
    3838    #region parameter properties
     
    5454    }
    5555    #endregion
     56    [StorableConstructor]
     57    private SymbolicRegressionScaledMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     58    private SymbolicRegressionScaledMeanSquaredErrorEvaluator(SymbolicRegressionScaledMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
    5659    public SymbolicRegressionScaledMeanSquaredErrorEvaluator()
    5760      : base() {
    5861      Parameters.Add(new LookupParameter<DoubleValue>("Alpha", "Alpha parameter for linear scaling of the estimated values."));
    5962      Parameters.Add(new LookupParameter<DoubleValue>("Beta", "Beta parameter for linear scaling of the estimated values."));
     63    }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new SymbolicRegressionScaledMeanSquaredErrorEvaluator(this, cloner);
    6067    }
    6168
Note: See TracChangeset for help on using the changeset viewer.