Changeset 5720 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Timestamp:
- 03/16/11 17:13:33 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.