Changeset 5770 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective
- Timestamp:
- 03/21/11 00:19:08 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5759 r5770 46 46 public override IOperation Apply() { 47 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);48 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 49 QualitiesParameter.ActualValue = new DoubleArray(qualities); 50 50 return base.Apply(); … … 61 61 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 62 62 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 LowerEstimationLimitParameter.ExecutionContext = context; 64 UpperEstimationLimitParameter.ExecutionContext = context; 63 EstimationLimitsParameter.ExecutionContext = context; 65 64 66 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);65 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 67 66 68 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 69 LowerEstimationLimitParameter.ExecutionContext = null; 70 UpperEstimationLimitParameter.ExecutionContext = null; 68 EstimationLimitsParameter.ExecutionContext = null; 71 69 72 70 return quality; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5759 r5770 26 26 public override IOperation Apply() { 27 27 IEnumerable<int> rows = GenerateRowsToEvaluate(); 28 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows);28 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 29 29 QualitiesParameter.ActualValue = new DoubleArray(qualities); 30 30 return base.Apply(); … … 46 46 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 47 47 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 48 LowerEstimationLimitParameter.ExecutionContext = context; 49 UpperEstimationLimitParameter.ExecutionContext = context; 48 EstimationLimitsParameter.ExecutionContext = context; 50 49 51 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows);50 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 52 51 53 52 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 54 LowerEstimationLimitParameter.ExecutionContext = null; 55 UpperEstimationLimitParameter.ExecutionContext = null; 53 EstimationLimitsParameter.ExecutionContext = null; 56 54 57 55 return quality; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r5759 r5770 34 34 private const int InitialMaximumTreeDepth = 8; 35 35 private const int InitialMaximumTreeLength = 25; 36 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 37 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 38 private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic classification model."; 39 private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic classification model."; 36 private const string EstimationLimitsParameterName = "EstimationLimits"; 37 private const string EstimationLimitsParameterDescription = "The lower and upper limit for the estimated value that can be returned by the symbolic classification model."; 40 38 41 39 #region parameter properties 42 public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter { 43 get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 44 } 45 public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 40 public IFixedValueParameter<DoubleLimit> EstimationLimitsParameter { 41 get { return (IFixedValueParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 47 42 } 48 43 #endregion 49 44 #region properties 50 public DoubleValue LowerEstimationLimit { 51 get { return LowerEstimationLimitParameter.Value; } 52 } 53 public DoubleValue UpperEstimationLimit { 54 get { return UpperEstimationLimitParameter.Value; } 45 public DoubleLimit EstimationLimits { 46 get { return EstimationLimitsParameter.Value; } 55 47 } 56 48 #endregion … … 62 54 public SymbolicClassificationMultiObjectiveProblem() 63 55 : base(new ClassificationProblemData(), new SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) { 64 Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue())); 65 Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue())); 56 Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription, new DoubleLimit())); 66 57 67 58 Maximization = new BoolArray(new bool[] { false, false }); … … 84 75 var mean = targetValues.Average(); 85 76 var range = targetValues.Max() - targetValues.Min(); 86 UpperEstimationLimit.Value= mean + PunishmentFactor * range;87 LowerEstimationLimit.Value= mean - PunishmentFactor * range;77 EstimationLimits.Upper = mean + PunishmentFactor * range; 78 EstimationLimits.Lower = mean - PunishmentFactor * range; 88 79 } 89 80 } … … 96 87 protected new void ParameterizeOperators() { 97 88 base.ParameterizeOperators(); 98 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 99 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) { 100 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 101 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; 89 if (Parameters.ContainsKey(EstimationLimitsParameterName)) { 90 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 91 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) { 92 op.EstimationLimitsParameter.ActualName = EstimationLimitsParameterName; 93 } 102 94 } 103 95 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs
r5747 r5770 20 20 #endregion 21 21 22 using System.Collections.Generic;23 using System.Linq;24 22 using HeuristicLab.Common; 25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators;29 using HeuristicLab.Optimization;30 26 using HeuristicLab.Parameters; 31 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 41 37 private const string ProblemDataParameterName = "ProblemData"; 42 38 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 43 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 44 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 39 private const string EstimationLimitsParameterName = "EstimationLimits"; 45 40 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 41 46 42 #region parameter properties 47 43 public ILookupParameter<IClassificationProblemData> ProblemDataParameter { … … 51 47 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 52 48 } 53 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 54 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 55 } 56 57 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 58 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 49 public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { 50 get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 59 51 } 60 52 public IValueParameter<BoolValue> ApplyLinearScalingParameter { … … 62 54 } 63 55 #endregion 56 64 57 #region properties 65 public IClassificationProblemData ProblemData {66 get { return ProblemDataParameter.ActualValue; }67 }68 public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter {69 get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; }70 }71 public DoubleValue UpperEstimationLimit {72 get { return UpperEstimationLimitParameter.ActualValue; }73 }74 public DoubleValue LowerEstimationLimit {75 get { return LowerEstimationLimitParameter.ActualValue; }76 }77 58 public BoolValue ApplyLinearScaling { 78 59 get { return ApplyLinearScalingParameter.Value; } … … 87 68 Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution.")); 88 69 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 89 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 90 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 70 Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model.")); 91 71 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false))); 92 72 } … … 96 76 97 77 protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) { 98 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter , LowerEstimationLimit.Value, UpperEstimationLimit.Value);99 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData );78 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper); 79 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue); 100 80 if (ApplyLinearScaling.Value) { 101 81 solution.ScaleModel(); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs
r5759 r5770 35 35 public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData>, 36 36 ISymbolicDataAnalysisBoundedOperator { 37 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 38 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 37 private const string EstimationLimitsParameterName = "EstimationLimits"; 39 38 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 40 39 41 40 #region parameter properties 42 public IValueLookupParameter<DoubleValue> UpperEstimationLimitParameter { 43 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 44 } 45 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 41 public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { 42 get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 47 43 } 48 44 public IValueParameter<BoolValue> ApplyLinearScalingParameter { … … 61 57 public SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer() 62 58 : base() { 63 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit for the estimated values produced by the symbolic classification model.")); 64 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit for the estimated values produced by the symbolic classification model.")); 59 Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The loewr and upper limit for the estimated values produced by the symbolic classification model.")); 65 60 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false))); 66 61 } … … 70 65 71 66 protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQualities) { 72 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value);67 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper); 73 68 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue); 74 69 if (ApplyLinearScaling.Value) {
Note: See TracChangeset
for help on using the changeset viewer.