Changeset 5759 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Timestamp:
- 03/19/11 02:22:45 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5747 r5759 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System;29 28 30 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 47 46 public override IOperation Apply() { 48 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimit .Value, UpperEstimationLimit.Value, ProblemData, rows);48 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows); 50 49 QualitiesParameter.ActualValue = new DoubleArray(qualities); 51 50 return base.Apply(); … … 65 64 UpperEstimationLimitParameter.ExecutionContext = context; 66 65 67 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter , tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);66 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows); 68 67 69 68 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5747 r5759 1 using System.Collections.Generic; 1 using System; 2 using System.Collections.Generic; 2 3 using HeuristicLab.Common; 3 4 using HeuristicLab.Core; … … 5 6 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 6 7 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 7 using System;8 8 9 9 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 26 26 public override IOperation Apply() { 27 27 IEnumerable<int> rows = GenerateRowsToEvaluate(); 28 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimit .Value, UpperEstimationLimit.Value, ProblemData, rows);28 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows); 29 29 QualitiesParameter.ActualValue = new DoubleArray(qualities); 30 30 return base.Apply(); … … 49 49 UpperEstimationLimitParameter.ExecutionContext = context; 50 50 51 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreter , tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);51 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows); 52 52 53 53 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r5733 r5759 71 71 InitializeOperators(); 72 72 UpdateEstimationLimits(); 73 UpdateDatasetPartitions();74 73 } 75 74 … … 81 80 82 81 private void UpdateEstimationLimits() { 83 if (ProblemData.TrainingPartition Start.Value < ProblemData.TrainingPartitionEnd.Value) {84 var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition Start.Value, ProblemData.TrainingPartitionEnd.Value);82 if (ProblemData.TrainingPartition.Start < ProblemData.TrainingPartition.End) { 83 var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End); 85 84 var mean = targetValues.Average(); 86 85 var range = targetValues.Max() - targetValues.Min(); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs
r5736 r5759 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; … … 47 43 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 48 44 } 49 50 45 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 51 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } … … 57 52 58 53 #region properties 59 public DoubleValue UpperEstimationLimit {60 get { return UpperEstimationLimitParameter.ActualValue; }61 }62 public DoubleValue LowerEstimationLimit {63 get { return LowerEstimationLimitParameter.ActualValue; }64 }65 54 public BoolValue ApplyLinearScaling { 66 55 get { return ApplyLinearScalingParameter.Value; } … … 81 70 82 71 protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQualities) { 83 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter , LowerEstimationLimit.Value, UpperEstimationLimit.Value);84 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData );72 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value); 73 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue); 85 74 if (ApplyLinearScaling.Value) { 86 75 solution.ScaleModel(); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs
r5747 r5759 47 47 public override IOperation Apply() { 48 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimit .Value, UpperEstimationLimit.Value, ProblemData, rows);49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows); 50 50 QualityParameter.ActualValue = new DoubleValue(quality); 51 51 return base.Apply(); … … 88 88 89 89 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 90 return Calculate(SymbolicDataAnalysisTreeInterpreter , tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);90 return Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows); 91 91 } 92 92 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5747 r5759 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System;29 28 30 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 47 46 public override IOperation Apply() { 48 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimit .Value, UpperEstimationLimit.Value, ProblemData, rows);48 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows); 50 49 QualityParameter.ActualValue = new DoubleValue(quality); 51 50 return base.Apply(); … … 64 63 UpperEstimationLimitParameter.ExecutionContext = context; 65 64 66 double mse = Calculate(SymbolicDataAnalysisTreeInterpreter , tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);65 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows); 67 66 68 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs
r5747 r5759 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 using System.Linq; 24 23 using HeuristicLab.Analysis; … … 26 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;29 using HeuristicLab.Operators;30 27 using HeuristicLab.Optimization; 31 28 using HeuristicLab.Parameters; 32 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.Problems.DataAnalysis.Symbolic;34 using System;35 30 36 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 81 76 double[] trainingQuality = QualityParameter.ActualValue.Select(x => x.Value).ToArray(); 82 77 // evaluate on validation partition 83 int start = Validation SamplesStart.Value;84 int end = Validation SamplesEnd.Value;78 int start = ValidationPartitionParameter.ActualValue.Start; 79 int end = ValidationPartitionParameter.ActualValue.End; 85 80 var rows = Enumerable.Range(start, end - start); 86 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(Evaluator );81 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(EvaluatorParameter.ActualValue); 87 82 double[] validationQuality = (from tree in SymbolicExpressionTrees 88 select Evaluator .Evaluate(childContext, tree, ProblemData, rows))83 select EvaluatorParameter.ActualValue.Evaluate(childContext, tree, ProblemDataParameter.ActualValue, rows)) 89 84 .ToArray(); 90 85 double r = alglib.spearmancorr2(trainingQuality, validationQuality); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5747 r5759 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 26 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System;29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 47 47 public override IOperation Apply() { 48 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimit .Value, UpperEstimationLimit.Value, ProblemData, rows);49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, ProblemDataParameter.ActualValue, rows); 50 50 QualityParameter.ActualValue = new DoubleValue(quality); 51 51 return base.Apply(); … … 69 69 UpperEstimationLimitParameter.ExecutionContext = context; 70 70 71 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreter , tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows);71 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value, problemData, rows); 72 72 73 73 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r5747 r5759 70 70 InitializeOperators(); 71 71 UpdateEstimationLimits(); 72 UpdateDatasetPartitions();73 72 } 74 73 … … 81 80 82 81 private void UpdateEstimationLimits() { 83 if (ProblemData.TrainingPartition Start.Value < ProblemData.TrainingPartitionEnd.Value) {84 var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition Start.Value, ProblemData.TrainingPartitionEnd.Value);82 if (ProblemData.TrainingPartition.Start < ProblemData.TrainingPartition.End) { 83 var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End); 85 84 var mean = targetValues.Average(); 86 85 var range = targetValues.Max() - targetValues.Min(); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs
r5736 r5759 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; … … 47 43 get { return (IValueLookupParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 48 44 } 49 50 45 public IValueLookupParameter<DoubleValue> LowerEstimationLimitParameter { 51 46 get { return (IValueLookupParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 52 47 } 53 54 48 public IValueParameter<BoolValue> ApplyLinearScalingParameter { 55 49 get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; } … … 58 52 59 53 #region properties 60 public DoubleValue UpperEstimationLimit {61 get { return UpperEstimationLimitParameter.ActualValue; }62 }63 public DoubleValue LowerEstimationLimit {64 get { return LowerEstimationLimitParameter.ActualValue; }65 }66 54 public BoolValue ApplyLinearScaling { 67 55 get { return ApplyLinearScalingParameter.Value; } … … 82 70 83 71 protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 84 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter , LowerEstimationLimit.Value, UpperEstimationLimit.Value);85 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData );72 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, LowerEstimationLimitParameter.ActualValue.Value, UpperEstimationLimitParameter.ActualValue.Value); 73 var solution = new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemDataParameter.ActualValue); 86 74 if (ApplyLinearScaling.Value) { 87 75 solution.ScaleModel();
Note: See TracChangeset
for help on using the changeset viewer.