Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4190 for trunk


Ignore:
Timestamp:
08/11/10 11:53:45 (14 years ago)
Author:
gkronber
Message:

Moved upper and lower estimation limit parameters into ISymbolicRegressionEvaluator interface and introduced an Evaluate method in the interface in preparation for a ISymbolicRegressionEvaluator parameter for the validation best solution analyzer. #1117

Location:
trunk/sources
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionNormalizedMeanSquaredErrorEvaluator.cs

    r4128 r4190  
    3434  [StorableClass]
    3535  public class SymbolicRegressionNormalizedMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    36     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    37     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    38 
    39     #region parameter properties
    40     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    41       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    42     }
    43     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    44       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    45     }
    46     #endregion
    47     #region properties
    48     public DoubleValue UpperEstimationLimit {
    49       get { return UpperEstimationLimitParameter.ActualValue; }
    50     }
    51     public DoubleValue LowerEstimationLimit {
    52       get { return LowerEstimationLimitParameter.ActualValue; }
    53     }
    54     #endregion
    5536    public SymbolicRegressionNormalizedMeanSquaredErrorEvaluator()
    5637      : base() {
    57       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."));
    58       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."));
    5938    }
    6039
    61     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
    62       double nmse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows);
     40    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
     41      double nmse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
    6342      return nmse;
    6443    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledNormalizedMeanSquaredErrorEvaluator.cs

    r4068 r4190  
    5959    }
    6060
    61     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
     61    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    6262      double alpha, beta;
    63       double nmse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows, out beta, out alpha);
     63      double nmse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows, out beta, out alpha);
    6464      AlphaParameter.ActualValue = new DoubleValue(alpha);
    6565      BetaParameter.ActualValue = new DoubleValue(beta);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SingleObjectiveSymbolicRegressionEvaluator.cs

    r4128 r4190  
    3939    private const string FunctionTreeParameterName = "FunctionTree";
    4040    private const string RegressionProblemDataParameterName = "RegressionProblemData";
     41    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
     42    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    4143    private const string SamplesStartParameterName = "SamplesStart";
    4244    private const string SamplesEndParameterName = "SamplesEnd";
     
    4446    #region ISymbolicRegressionEvaluator Members
    4547
     48    public ILookupParameter<IRandom> RandomParameter {
     49      get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; }
     50    }
    4651    public ILookupParameter<DoubleValue> QualityParameter {
    4752      get { return (ILookupParameter<DoubleValue>)Parameters[QualityParameterName]; }
     
    6772      get { return (IValueLookupParameter<IntValue>)Parameters[SamplesEndParameterName]; }
    6873    }
    69 
     74    public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
     75      get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     76    }
     77    public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
     78      get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     79    }
    7080    public IValueParameter<PercentValue> RelativeNumberOfEvaluatedSamplesParameter {
    7181      get { return (IValueParameter<PercentValue>)Parameters[RelativeNumberOfEvaluatedSamplesParameterName]; }
    7282    }
    7383
    74     public ILookupParameter<IRandom> RandomParameter {
    75       get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; }
    76     }
    7784
    7885    #endregion
     
    96103      get { return SamplesEndParameter.ActualValue; }
    97104    }
    98 
     105    public DoubleValue UpperEstimationLimit {
     106      get { return UpperEstimationLimitParameter.ActualValue; }
     107    }
     108    public DoubleValue LowerEstimationLimit {
     109      get { return LowerEstimationLimitParameter.ActualValue; }
     110    }
    99111    public PercentValue RelativeNumberOfEvaluatedSamples {
    100112      get { return RelativeNumberOfEvaluatedSamplesParameter.Value; }
     
    111123      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The start index of the dataset partition on which the symbolic regression solution should be evaluated."));
    112124      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end index of the dataset partition on which the symbolic regression solution should be evaluated."));
     125      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."));
     126      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."));
    113127      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)));
    114128    }
     
    127141      uint seed = (uint)Random.Next();
    128142      IEnumerable<int> rows = GenerateRowsToEvaluate(seed, RelativeNumberOfEvaluatedSamples.Value, SamplesStart.Value, SamplesEnd.Value);
    129       double quality = Evaluate(SymbolicExpressionTreeInterpreter, SymbolicExpressionTree, RegressionProblemData.Dataset,
    130         RegressionProblemData.TargetVariable, rows);
     143      double quality = Evaluate(SymbolicExpressionTreeInterpreter, SymbolicExpressionTree, LowerEstimationLimit.Value, UpperEstimationLimit.Value,
     144        RegressionProblemData.Dataset,
     145        RegressionProblemData.TargetVariable.Value, rows);
    131146      QualityParameter.ActualValue = new DoubleValue(quality);
    132147      return base.Apply();
     
    141156    }
    142157
    143     protected abstract double Evaluate(ISymbolicExpressionTreeInterpreter interpreter,
    144       SymbolicExpressionTree solution,
     158    public abstract double Evaluate(ISymbolicExpressionTreeInterpreter interpreter,
     159      SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit,
    145160      Dataset dataset,
    146       StringValue targetVariable,
     161      string targetVariable,
    147162      IEnumerable<int> rows);
    148163  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionMeanSquaredErrorEvaluator.cs

    r4128 r4190  
    3434  [StorableClass]
    3535  public class SymbolicRegressionMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    36     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    37     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    3836
    39     #region parameter properties
    40     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    41       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    42     }
    43     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    44       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    45     }
    46     #endregion
    47     #region properties
    48     public DoubleValue UpperEstimationLimit {
    49       get { return UpperEstimationLimitParameter.ActualValue; }
    50     }
    51     public DoubleValue LowerEstimationLimit {
    52       get { return LowerEstimationLimitParameter.ActualValue; }
    53     }
    54     #endregion
    5537    public SymbolicRegressionMeanSquaredErrorEvaluator()
    5638      : base() {
    57       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."));
    58       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."));
    5939    }
    6040
    61     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
    62       double mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows);
     41    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
     42      double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
    6343      return mse;
    6444    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4128 r4190  
    3434  [StorableClass]
    3535  public class SymbolicRegressionPearsonsRSquaredEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    36     private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    37     private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
    38 
    39     #region parameter properties
    40     public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter {
    41       get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    42     }
    43     public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter {
    44       get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    45     }
    46     #endregion
    47     #region properties
    48     public DoubleValue UpperEstimationLimit {
    49       get { return UpperEstimationLimitParameter.ActualValue; }
    50     }
    51     public DoubleValue LowerEstimationLimit {
    52       get { return LowerEstimationLimitParameter.ActualValue; }
    53     }
    54     #endregion
    5536    public SymbolicRegressionPearsonsRSquaredEvaluator()
    5637      : base() {
    57       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."));
    58       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."));
    5938    }
    6039
    61     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
    62       double mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows);
     40    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
     41      double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
    6342      return mse;
    6443    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator.cs

    r4128 r4190  
    102102    }
    103103
    104     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
     104    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    105105      double alpha, beta;
    106106      double meanSE, varianceSE;
     
    109109      double mse;
    110110      if (ApplyScaling.Value) {
    111         mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows, out beta, out alpha, out meanSE, out varianceSE, out count, out bias, out variance, out covariance);
     111        mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable, rows, out beta, out alpha, out meanSE, out varianceSE, out count, out bias, out variance, out covariance);
    112112        Alpha = new DoubleValue(alpha);
    113113        Beta = new DoubleValue(beta);
    114114      } else {
    115         mse = CalculateWithScaling(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows, 1, 0, out meanSE, out varianceSE, out count, out bias, out variance, out covariance);
     115        mse = CalculateWithScaling(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable, rows, 1, 0, out meanSE, out varianceSE, out count, out bias, out variance, out covariance);
    116116      }
    117117      QualityVariance = new DoubleValue(varianceSE);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs

    r4128 r4190  
    6060    }
    6161
    62     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
     62    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    6363      double alpha, beta;
    64       double mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows, out beta, out alpha);
     64      double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows, out beta, out alpha);
    6565      AlphaParameter.ActualValue = new DoubleValue(alpha);
    6666      BetaParameter.ActualValue = new DoubleValue(beta);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Interfaces/ISymbolicRegressionEvaluator.cs

    r4128 r4190  
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Optimization;
     26using HeuristicLab.Problems.DataAnalysis.Symbolic;
     27using System.Collections.Generic;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
    2830  public interface ISymbolicRegressionEvaluator : ISingleObjectiveEvaluator {
     31    ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter { get; }
    2932    ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
    3033    ILookupParameter<DataAnalysisProblemData> RegressionProblemDataParameter { get; }
    3134    IValueLookupParameter<IntValue> SamplesStartParameter { get; }
    3235    IValueLookupParameter<IntValue> SamplesEndParameter { get; }
     36    IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { get; }
     37    IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { get; }
     38
     39
     40    double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree tree,
     41          double lowerEstimationLimit, double upperEstimationLimit,
     42          Dataset dataset, string targetVariable, IEnumerable<int> rows);
    3343  }
    3444}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs

    r4128 r4190  
    154154      : base() {
    155155      SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();
    156       var grammar = new FullFunctionalExpressionGrammar();
     156      var grammar = new BasicExpressionGrammar();
    157157      var globalGrammar = new GlobalSymbolicExpressionGrammar(grammar);
    158158      var interpreter = new SimpleArithmeticExpressionInterpreter();
Note: See TracChangeset for help on using the changeset viewer.