Changeset 5720
- Timestamp:
- 03/16/11 17:13:33 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 1 added
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs
r5699 r5720 106 106 public static IEnumerable<double> LimitToRange(this IEnumerable<double> values, double min, double max) { 107 107 foreach (var x in values) { 108 if (double.IsNaN(x)) yield return max;108 if (double.IsNaN(x)) yield return (max + min) / 2.0; 109 109 else if (x < min) yield return min; 110 110 else if (x > max) yield return max; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r5716 r5720 97 97 base.ParameterizeOperators(); 98 98 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 99 foreach (var op in operators.OfType<ISymbolicDataAnalysisBounded Evaluator<IClassificationProblemData>>()) {99 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) { 100 100 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 101 101 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs
r5685 r5720 41 41 private const string ProblemDataParameterName = "ProblemData"; 42 42 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 45 #region parameter properties 44 46 public ILookupParameter<IClassificationProblemData> ProblemDataParameter { … … 47 49 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 48 50 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 51 } 52 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 53 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 54 } 55 56 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 49 58 } 50 59 #endregion … … 56 65 get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; } 57 66 } 67 public DoubleValue UpperEstimationLimit { 68 get { return UpperEstimationLimitParameter.ActualValue; } 69 } 70 public DoubleValue LowerEstimationLimit { 71 get { return LowerEstimationLimitParameter.ActualValue; } 72 } 58 73 #endregion 74 59 75 [StorableConstructor] 60 76 private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 64 80 Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution.")); 65 81 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 82 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 83 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 66 84 } 67 85 public override IDeepCloneable Clone(Cloner cloner) { … … 73 91 double[] classValues; 74 92 double[] thresholds; 75 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes); 93 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes) 94 .LimitToRange(LowerEstimationLimit.Value, UpperEstimationLimit.Value); 76 95 var targetValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); 77 96 AccuracyMaximizationThresholdCalculator.CalculateThresholds(ProblemData, estimatedValues, targetValues, out classValues, out thresholds); 78 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds );97 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 79 98 return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData); 80 99 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs
r5685 r5720 37 37 [Item("SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for multi objective symbolic classification problems.")] 38 38 [StorableClass] 39 public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData> { 39 public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData>, 40 ISymbolicDataAnalysisBoundedOperator { 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 44 #region parameter properties 45 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 47 } 48 49 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 51 } 52 #endregion 53 54 #region properties 55 public DoubleValue UpperEstimationLimit { 56 get { return UpperEstimationLimitParameter.ActualValue; } 57 } 58 public DoubleValue LowerEstimationLimit { 59 get { return LowerEstimationLimitParameter.ActualValue; } 60 } 61 #endregion 40 62 [StorableConstructor] 41 63 private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 43 65 public SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer() 44 66 : base() { 67 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 68 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 45 69 } 46 70 public override IDeepCloneable Clone(Cloner cloner) { … … 52 76 double[] thresholds; 53 77 // calculate thresholds on the whole training set even for the validation best solution 54 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes); 78 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes) 79 .LimitToRange(LowerEstimationLimit.Value, UpperEstimationLimit.Value); 55 80 var targetClassValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); 56 81 AccuracyMaximizationThresholdCalculator.CalculateThresholds(ProblemData, estimatedValues, targetClassValues, out classValues, out thresholds); 57 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds );82 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 58 83 return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData); 59 84 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r5716 r5720 96 96 base.ParameterizeOperators(); 97 97 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 98 foreach (var op in operators.OfType<ISymbolicDataAnalysisBounded Evaluator<IClassificationProblemData>>()) {98 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) { 99 99 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 100 100 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs
r5685 r5720 38 38 [StorableClass] 39 39 public sealed class SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>, 40 ISymbolicDataAnalysisInterpreterOperator {40 ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator { 41 41 private const string ProblemDataParameterName = "ProblemData"; 42 42 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 45 #region parameter properties 44 46 public ILookupParameter<IClassificationProblemData> ProblemDataParameter { … … 47 49 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 48 50 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 51 } 52 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 53 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 54 } 55 56 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 49 58 } 50 59 #endregion … … 56 65 get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; } 57 66 } 67 public DoubleValue UpperEstimationLimit { 68 get { return UpperEstimationLimitParameter.ActualValue; } 69 } 70 public DoubleValue LowerEstimationLimit { 71 get { return LowerEstimationLimitParameter.ActualValue; } 72 } 58 73 #endregion 74 59 75 [StorableConstructor] 60 76 private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 64 80 Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution.")); 65 81 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 82 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 83 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 66 84 } 67 85 public override IDeepCloneable Clone(Cloner cloner) { … … 72 90 double[] classValues; 73 91 double[] thresholds; 74 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes); 92 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes) 93 .LimitToRange(LowerEstimationLimit.Value, UpperEstimationLimit.Value); 75 94 var targetValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); 76 95 AccuracyMaximizationThresholdCalculator.CalculateThresholds(ProblemData, estimatedValues, targetValues, out classValues, out thresholds); 77 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds );96 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 78 97 return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData); 79 98 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs
r5685 r5720 37 37 [Item("SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for single objective symbolic classification problems.")] 38 38 [StorableClass] 39 public sealed class SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData> { 39 public sealed class SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>, 40 ISymbolicDataAnalysisBoundedOperator { 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 44 #region parameter properties 45 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 47 } 48 49 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 51 } 52 #endregion 53 54 #region properties 55 public DoubleValue UpperEstimationLimit { 56 get { return UpperEstimationLimitParameter.ActualValue; } 57 } 58 public DoubleValue LowerEstimationLimit { 59 get { return LowerEstimationLimitParameter.ActualValue; } 60 } 61 #endregion 40 62 [StorableConstructor] 41 63 private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 43 65 public SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer() 44 66 : base() { 67 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 68 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 45 69 } 46 70 public override IDeepCloneable Clone(Cloner cloner) { … … 52 76 double[] thresholds; 53 77 // calculate thresholds on the whole training set even for the validation best solution 54 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes); 78 var estimatedValues = SymbolicDataAnalysisTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, ProblemData.TrainingIndizes) 79 .LimitToRange(LowerEstimationLimit.Value, UpperEstimationLimit.Value); 55 80 var targetClassValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); 56 81 AccuracyMaximizationThresholdCalculator.CalculateThresholds(ProblemData, estimatedValues, targetClassValues, out classValues, out thresholds); 57 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds );82 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 58 83 return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData); 59 84 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs
r5649 r5720 39 39 [Item(Name = "SymbolicClassificationModel", Description = "Represents a symbolic classification model.")] 40 40 public class SymbolicClassificationModel : SymbolicDataAnalysisModel, ISymbolicClassificationModel { 41 42 41 [StorableConstructor] 43 42 protected SymbolicClassificationModel(bool deserializing) : base(deserializing) { } … … 53 52 } 54 53 55 #region IClassificationModel Members56 57 54 public IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) { 58 55 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows); 59 56 } 60 61 #endregion62 57 } 63 58 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
r5678 r5720 55 55 set { classValues = value.ToArray(); } 56 56 } 57 [Storable] 58 private double lowerEstimationLimit; 59 public double LowerEstimationLimit { get { return lowerEstimationLimit; } } 60 [Storable] 61 private double upperEstimationLimit; 62 public double UpperEstimationLimit { get { return upperEstimationLimit; } } 63 57 64 [StorableConstructor] 58 65 protected SymbolicDiscriminantFunctionClassificationModel(bool deserializing) : base(deserializing) { } … … 61 68 classValues = (double[])original.classValues.Clone(); 62 69 thresholds = (double[])original.thresholds.Clone(); 70 lowerEstimationLimit = original.lowerEstimationLimit; 71 upperEstimationLimit = original.upperEstimationLimit; 63 72 } 64 public SymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IEnumerable<double> classValues, IEnumerable<double> thresholds) 73 public SymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 74 IEnumerable<double> classValues, IEnumerable<double> thresholds, 75 double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) 65 76 : base(tree, interpreter) { 66 77 this.classValues = classValues.ToArray(); 67 78 this.thresholds = thresholds.ToArray(); 79 this.lowerEstimationLimit = lowerEstimationLimit; 80 this.upperEstimationLimit = upperEstimationLimit; 68 81 } 69 82 … … 94 107 if (listener != null) listener(this, e); 95 108 } 96 #endregion 109 #endregion 97 110 } 98 111 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs
r5716 r5720 98 98 base.ParameterizeOperators(); 99 99 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 100 foreach (var op in operators.OfType<ISymbolicDataAnalysisBounded Evaluator<IRegressionProblemData>>()) {100 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) { 101 101 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 102 102 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs
r5685 r5720 41 41 private const string ProblemDataParameterName = "ProblemData"; 42 42 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 43 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 44 45 #region parameter properties 45 46 public ILookupParameter<IRegressionProblemData> ProblemDataParameter { … … 48 49 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 49 50 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 51 } 52 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 53 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 54 } 55 56 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 50 58 } 51 59 #endregion … … 58 66 get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; } 59 67 } 68 public DoubleValue UpperEstimationLimit { 69 get { return UpperEstimationLimitParameter.ActualValue; } 70 } 71 public DoubleValue LowerEstimationLimit { 72 get { return LowerEstimationLimitParameter.ActualValue; } 73 } 60 74 #endregion 61 75 … … 67 81 Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution.")); 68 82 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 83 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 84 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 69 85 } 70 86 … … 74 90 75 91 protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) { 76 return new SymbolicRegressionSolution(new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter), ProblemData); 92 var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 93 return new SymbolicRegressionSolution(model, ProblemData); 77 94 } 78 95 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs
r5685 r5720 37 37 [Item("SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for multi objective symbolic regression problems.")] 38 38 [StorableClass] 39 public sealed class SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionMultiObjectiveEvaluator, IRegressionProblemData> { 39 public sealed class SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionMultiObjectiveEvaluator, IRegressionProblemData>, 40 ISymbolicDataAnalysisBoundedOperator { 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 44 #region parameter properties 45 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 47 } 48 49 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 51 } 52 #endregion 53 54 #region properties 55 public DoubleValue UpperEstimationLimit { 56 get { return UpperEstimationLimitParameter.ActualValue; } 57 } 58 public DoubleValue LowerEstimationLimit { 59 get { return LowerEstimationLimitParameter.ActualValue; } 60 } 61 #endregion 40 62 [StorableConstructor] 41 63 private SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 43 65 public SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer() 44 66 : base() { 67 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 68 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 45 69 } 46 70 public override IDeepCloneable Clone(Cloner cloner) { … … 49 73 50 74 protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) { 51 return new SymbolicRegressionSolution(new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter), ProblemData); 75 var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 76 return new SymbolicRegressionSolution(model, ProblemData); 52 77 } 53 78 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
r5716 r5720 98 98 base.ParameterizeOperators(); 99 99 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 100 foreach (var op in operators.OfType<ISymbolicDataAnalysisBounded Evaluator<IRegressionProblemData>>()) {100 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) { 101 101 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 102 102 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs
r5685 r5720 41 41 private const string ProblemDataParameterName = "ProblemData"; 42 42 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 45 #region parameter properties 44 46 public ILookupParameter<IRegressionProblemData> ProblemDataParameter { … … 48 50 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 49 51 } 52 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 53 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 54 } 55 56 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 57 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 58 } 50 59 #endregion 60 51 61 #region properties 52 62 public IRegressionProblemData ProblemData { … … 55 65 public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter { 56 66 get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; } 67 } 68 public DoubleValue UpperEstimationLimit { 69 get { return UpperEstimationLimitParameter.ActualValue; } 70 } 71 public DoubleValue LowerEstimationLimit { 72 get { return LowerEstimationLimitParameter.ActualValue; } 57 73 } 58 74 #endregion … … 64 80 Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution.")); 65 81 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 82 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 83 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 66 84 } 67 85 public override IDeepCloneable Clone(Cloner cloner) { … … 70 88 71 89 protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 72 return new SymbolicRegressionSolution(new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter), ProblemData); 90 var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 91 return new SymbolicRegressionSolution(model, ProblemData); 73 92 } 74 93 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs
r5685 r5720 37 37 [Item("SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for single objective symbolic regression problems.")] 38 38 [StorableClass] 39 public sealed class SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData> { 39 public sealed class SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData>, 40 ISymbolicDataAnalysisBoundedOperator { 41 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 42 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 43 44 #region parameter properties 45 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 47 } 48 49 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 50 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 51 } 52 #endregion 53 54 #region properties 55 public DoubleValue UpperEstimationLimit { 56 get { return UpperEstimationLimitParameter.ActualValue; } 57 } 58 public DoubleValue LowerEstimationLimit { 59 get { return LowerEstimationLimitParameter.ActualValue; } 60 } 61 #endregion 62 40 63 [StorableConstructor] 41 64 private SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } … … 43 66 public SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer() 44 67 : base() { 68 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic regression model.")); 69 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic regression model.")); 45 70 } 71 46 72 public override IDeepCloneable Clone(Cloner cloner) { 47 73 return new SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer(this, cloner); … … 49 75 50 76 protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 51 return new SymbolicRegressionSolution(new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter), ProblemData); 77 var model = new SymbolicRegressionModel(bestTree, SymbolicDataAnalysisTreeInterpreter, LowerEstimationLimit.Value, UpperEstimationLimit.Value); 78 return new SymbolicRegressionSolution(model, ProblemData); 52 79 } 53 80 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs
r5649 r5720 39 39 [Item(Name = "SymbolicRegressionModel", Description = "Represents a symbolic regression model.")] 40 40 public class SymbolicRegressionModel : SymbolicDataAnalysisModel, ISymbolicRegressionModel { 41 [Storable] 42 private double lowerEstimationLimit; 43 [Storable] 44 private double upperEstimationLimit; 41 45 42 46 [StorableConstructor] … … 44 48 protected SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner) 45 49 : base(original, cloner) { 50 this.lowerEstimationLimit = original.lowerEstimationLimit; 51 this.upperEstimationLimit = original.upperEstimationLimit; 46 52 } 47 public SymbolicRegressionModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter) 53 public SymbolicRegressionModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 54 double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) 48 55 : base(tree, interpreter) { 56 this.lowerEstimationLimit = lowerEstimationLimit; 57 this.upperEstimationLimit = upperEstimationLimit; 49 58 } 50 59 … … 54 63 55 64 public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) { 56 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows); 65 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows) 66 .LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 67 } 58 68 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r5717 r5720 39 39 [Item(Name = "SymbolicRegressionSolution", Description = "Represents a symbolic regression solution (model + data) and attributes of the solution like accuracy and complexity.")] 40 40 public sealed class SymbolicRegressionSolution : RegressionSolution, ISymbolicRegressionSolution { 41 #region ISymbolicRegressionSolution Members42 43 41 public new ISymbolicRegressionModel Model { 44 42 get { return (ISymbolicRegressionModel)base.Model; } … … 48 46 get { return (ISymbolicDataAnalysisModel)base.Model; } 49 47 } 50 51 #endregion52 48 53 49 [StorableConstructor] -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
r5689 r5720 35 35 [StorableClass] 36 36 public abstract class SymbolicDataAnalysisEvaluator<T> : SingleSuccessorOperator, 37 ISymbolicDataAnalysis BoundedEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator37 ISymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator 38 38 where T : class, IDataAnalysisProblemData { 39 39 private const string RandomParameterName = "Random"; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r5685 r5720 119 119 </Compile> 120 120 <Compile Include="Analyzers\SymbolicDataAnalysisVariableFrequencyAnalyzer.cs" /> 121 <Compile Include="Interfaces\ISymbolicDataAnalysisBoundedOperator.cs" /> 121 122 <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionTreeInterpreter.cs" /> 122 123 <Compile Include="SymbolicDataAnalysisExpressionTreeCreator.cs" /> … … 178 179 <Compile Include="Interfaces\ISymbolicDataAnalysisInterpreterOperator.cs" /> 179 180 <Compile Include="Interfaces\ISymbolicDataAnalysisMultiObjectiveEvaluator.cs" /> 180 <Compile Include="Interfaces\ISymbolicDataAnalysisBoundedEvaluator.cs" />181 181 <Compile Include="Interfaces\ISymbolicDataAnalysisEvaluator.cs" /> 182 182 <Compile Include="Interfaces\ISymbolicDataAnalysisGrammar.cs" />
Note: See TracChangeset
for help on using the changeset viewer.