- Timestamp:
- 08/11/10 11:53:45 (14 years ago)
- 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 34 34 [StorableClass] 35 35 public class SymbolicRegressionNormalizedMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator { 36 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";37 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";38 39 #region parameter properties40 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 #endregion47 #region properties48 public DoubleValue UpperEstimationLimit {49 get { return UpperEstimationLimitParameter.ActualValue; }50 }51 public DoubleValue LowerEstimationLimit {52 get { return LowerEstimationLimitParameter.ActualValue; }53 }54 #endregion55 36 public SymbolicRegressionNormalizedMeanSquaredErrorEvaluator() 56 37 : 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."));59 38 } 60 39 61 p rotected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValuetargetVariable, 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); 63 42 return nmse; 64 43 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledNormalizedMeanSquaredErrorEvaluator.cs
r4068 r4190 59 59 } 60 60 61 p rotected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValuetargetVariable, IEnumerable<int> rows) {61 public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) { 62 62 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); 64 64 AlphaParameter.ActualValue = new DoubleValue(alpha); 65 65 BetaParameter.ActualValue = new DoubleValue(beta); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SingleObjectiveSymbolicRegressionEvaluator.cs
r4128 r4190 39 39 private const string FunctionTreeParameterName = "FunctionTree"; 40 40 private const string RegressionProblemDataParameterName = "RegressionProblemData"; 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 41 43 private const string SamplesStartParameterName = "SamplesStart"; 42 44 private const string SamplesEndParameterName = "SamplesEnd"; … … 44 46 #region ISymbolicRegressionEvaluator Members 45 47 48 public ILookupParameter<IRandom> RandomParameter { 49 get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; } 50 } 46 51 public ILookupParameter<DoubleValue> QualityParameter { 47 52 get { return (ILookupParameter<DoubleValue>)Parameters[QualityParameterName]; } … … 67 72 get { return (IValueLookupParameter<IntValue>)Parameters[SamplesEndParameterName]; } 68 73 } 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 } 70 80 public IValueParameter<PercentValue> RelativeNumberOfEvaluatedSamplesParameter { 71 81 get { return (IValueParameter<PercentValue>)Parameters[RelativeNumberOfEvaluatedSamplesParameterName]; } 72 82 } 73 83 74 public ILookupParameter<IRandom> RandomParameter {75 get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; }76 }77 84 78 85 #endregion … … 96 103 get { return SamplesEndParameter.ActualValue; } 97 104 } 98 105 public DoubleValue UpperEstimationLimit { 106 get { return UpperEstimationLimitParameter.ActualValue; } 107 } 108 public DoubleValue LowerEstimationLimit { 109 get { return LowerEstimationLimitParameter.ActualValue; } 110 } 99 111 public PercentValue RelativeNumberOfEvaluatedSamples { 100 112 get { return RelativeNumberOfEvaluatedSamplesParameter.Value; } … … 111 123 Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The start index of the dataset partition on which the symbolic regression solution should be evaluated.")); 112 124 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.")); 113 127 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 128 } … … 127 141 uint seed = (uint)Random.Next(); 128 142 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); 131 146 QualityParameter.ActualValue = new DoubleValue(quality); 132 147 return base.Apply(); … … 141 156 } 142 157 143 p rotectedabstract double Evaluate(ISymbolicExpressionTreeInterpreter interpreter,144 SymbolicExpressionTree solution, 158 public abstract double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, 159 SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, 145 160 Dataset dataset, 146 StringValuetargetVariable,161 string targetVariable, 147 162 IEnumerable<int> rows); 148 163 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionMeanSquaredErrorEvaluator.cs
r4128 r4190 34 34 [StorableClass] 35 35 public class SymbolicRegressionMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator { 36 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";37 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";38 36 39 #region parameter properties40 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 #endregion47 #region properties48 public DoubleValue UpperEstimationLimit {49 get { return UpperEstimationLimitParameter.ActualValue; }50 }51 public DoubleValue LowerEstimationLimit {52 get { return LowerEstimationLimitParameter.ActualValue; }53 }54 #endregion55 37 public SymbolicRegressionMeanSquaredErrorEvaluator() 56 38 : 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."));59 39 } 60 40 61 p rotected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValuetargetVariable, 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); 63 43 return mse; 64 44 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionPearsonsRSquaredEvaluator.cs
r4128 r4190 34 34 [StorableClass] 35 35 public class SymbolicRegressionPearsonsRSquaredEvaluator : SingleObjectiveSymbolicRegressionEvaluator { 36 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";37 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";38 39 #region parameter properties40 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 #endregion47 #region properties48 public DoubleValue UpperEstimationLimit {49 get { return UpperEstimationLimitParameter.ActualValue; }50 }51 public DoubleValue LowerEstimationLimit {52 get { return LowerEstimationLimitParameter.ActualValue; }53 }54 #endregion55 36 public SymbolicRegressionPearsonsRSquaredEvaluator() 56 37 : 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."));59 38 } 60 39 61 p rotected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValuetargetVariable, 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); 63 42 return mse; 64 43 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator.cs
r4128 r4190 102 102 } 103 103 104 p rotected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValuetargetVariable, IEnumerable<int> rows) {104 public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) { 105 105 double alpha, beta; 106 106 double meanSE, varianceSE; … … 109 109 double mse; 110 110 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); 112 112 Alpha = new DoubleValue(alpha); 113 113 Beta = new DoubleValue(beta); 114 114 } 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); 116 116 } 117 117 QualityVariance = new DoubleValue(varianceSE); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs
r4128 r4190 60 60 } 61 61 62 p rotected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValuetargetVariable, IEnumerable<int> rows) {62 public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) { 63 63 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); 65 65 AlphaParameter.ActualValue = new DoubleValue(alpha); 66 66 BetaParameter.ActualValue = new DoubleValue(beta); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Interfaces/ISymbolicRegressionEvaluator.cs
r4128 r4190 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Optimization; 26 using HeuristicLab.Problems.DataAnalysis.Symbolic; 27 using System.Collections.Generic; 26 28 27 29 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic { 28 30 public interface ISymbolicRegressionEvaluator : ISingleObjectiveEvaluator { 31 ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter { get; } 29 32 ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; } 30 33 ILookupParameter<DataAnalysisProblemData> RegressionProblemDataParameter { get; } 31 34 IValueLookupParameter<IntValue> SamplesStartParameter { get; } 32 35 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); 33 43 } 34 44 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs
r4128 r4190 154 154 : base() { 155 155 SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator(); 156 var grammar = new FullFunctionalExpressionGrammar();156 var grammar = new BasicExpressionGrammar(); 157 157 var globalGrammar = new GlobalSymbolicExpressionGrammar(grammar); 158 158 var interpreter = new SimpleArithmeticExpressionInterpreter();
Note: See TracChangeset
for help on using the changeset viewer.