Changeset 5851 for trunk/sources
- Timestamp:
- 03/28/11 20:04:51 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5809 r5851 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 46 47 public override IOperation Apply() { 47 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 var solution = SymbolicExpressionTreeParameter.ActualValue; 50 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 51 QualitiesParameter.ActualValue = new DoubleArray(qualities); 52 AddEvaluatedNodes(solution.Length * rows.Count()); 50 53 return base.Apply(); 51 54 } … … 62 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 66 EstimationLimitsParameter.ExecutionContext = context; 67 EvaluatedNodesParameter.ExecutionContext = context; 64 68 65 69 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 70 AddEvaluatedNodes(tree.Length * rows.Count()); 66 71 67 72 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 73 EstimationLimitsParameter.ExecutionContext = null; 74 EvaluatedNodesParameter.ExecutionContext = null; 69 75 70 76 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5846 r5851 1 1 using System; 2 using System.Linq; 2 3 using System.Collections.Generic; 3 4 using HeuristicLab.Common; … … 26 27 public override IOperation Apply() { 27 28 IEnumerable<int> rows = GenerateRowsToEvaluate(); 28 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 29 var solution = SymbolicExpressionTreeParameter.ActualValue; 30 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 29 31 QualitiesParameter.ActualValue = new DoubleArray(qualities); 32 AddEvaluatedNodes(solution.Length * rows.Count()); 30 33 return base.Apply(); 31 34 } … … 41 44 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 42 45 EstimationLimitsParameter.ExecutionContext = context; 46 EvaluatedNodesParameter.ExecutionContext = context; 43 47 44 48 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 45 49 AddEvaluatedNodes(tree.Length * rows.Count()); 50 46 51 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 47 52 EstimationLimitsParameter.ExecutionContext = null; 53 EvaluatedNodesParameter.ExecutionContext = null; 48 54 49 55 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs
r5809 r5851 33 33 [StorableClass] 34 34 public class SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator { 35 36 35 [StorableConstructor] 37 36 protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { } … … 47 46 public override IOperation Apply() { 48 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 48 var solution = SymbolicExpressionTreeParameter.ActualValue; 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 50 QualityParameter.ActualValue = new DoubleValue(quality); 51 AddEvaluatedNodes(solution.Length * rows.Count()); 51 52 return base.Apply(); 52 53 } … … 88 89 89 90 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 90 return Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 91 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 92 EstimationLimitsParameter.ExecutionContext = context; 93 EvaluatedNodesParameter.ExecutionContext = context; 94 95 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 96 AddEvaluatedNodes(tree.Length * rows.Count()); 97 98 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 99 EstimationLimitsParameter.ExecutionContext = null; 100 EvaluatedNodesParameter.ExecutionContext = null; 101 102 return mse; 91 103 } 92 104 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5809 r5851 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 46 47 public override IOperation Apply() { 47 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 var solution = SymbolicExpressionTreeParameter.ActualValue; 50 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 51 QualityParameter.ActualValue = new DoubleValue(quality); 52 AddEvaluatedNodes(solution.Length * rows.Count()); 50 53 return base.Apply(); 51 54 } … … 61 64 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 62 65 EstimationLimitsParameter.ExecutionContext = context; 66 EvaluatedNodesParameter.ExecutionContext = context; 63 67 64 68 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 69 AddEvaluatedNodes(tree.Length * rows.Count()); 65 70 66 71 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 67 72 EstimationLimitsParameter.ExecutionContext = null; 73 EvaluatedNodesParameter.ExecutionContext = null; 68 74 69 75 return mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5846 r5851 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Collections.Generic; 24 25 using HeuristicLab.Common; … … 47 48 public override IOperation Apply() { 48 49 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 var solution = SymbolicExpressionTreeParameter.ActualValue; 51 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 52 QualityParameter.ActualValue = new DoubleValue(quality); 53 AddEvaluatedNodes(solution.Length * rows.Count()); 51 54 return base.Apply(); 52 55 } … … 62 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 66 EstimationLimitsParameter.ExecutionContext = context; 67 EvaluatedNodesParameter.ExecutionContext = context; 64 68 65 69 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 70 AddEvaluatedNodes(tree.Length * rows.Count()); 66 71 67 72 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 73 EstimationLimitsParameter.ExecutionContext = null; 74 EvaluatedNodesParameter.ExecutionContext = null; 69 75 70 76 return r2; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5809 r5851 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 46 47 public override Core.IOperation Apply() { 47 48 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 var solution = SymbolicExpressionTreeParameter.ActualValue; 50 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 51 QualitiesParameter.ActualValue = new DoubleArray(qualities); 52 AddEvaluatedNodes(solution.Length * rows.Count()); 50 53 return base.Apply(); 51 54 } … … 62 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 66 EstimationLimitsParameter.ExecutionContext = context; 67 EvaluatedNodesParameter.ExecutionContext = context; 64 68 65 69 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 70 AddEvaluatedNodes(tree.Length * rows.Count()); 66 71 67 72 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 73 EstimationLimitsParameter.ExecutionContext = null; 74 EvaluatedNodesParameter.ExecutionContext = null; 69 75 70 76 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5846 r5851 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Collections.Generic; 24 25 using HeuristicLab.Common; … … 47 48 public override IOperation Apply() { 48 49 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 var solution = SymbolicExpressionTreeParameter.ActualValue; 51 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 52 QualitiesParameter.ActualValue = new DoubleArray(qualities); 53 AddEvaluatedNodes(solution.Length * rows.Count()); 51 54 return base.Apply(); 52 55 } … … 62 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 66 EstimationLimitsParameter.ExecutionContext = context; 67 EvaluatedNodesParameter.ExecutionContext = context; 64 68 65 69 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 70 AddEvaluatedNodes(tree.Length * rows.Count()); 66 71 67 72 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 73 EstimationLimitsParameter.ExecutionContext = null; 74 EvaluatedNodesParameter.ExecutionContext = null; 69 75 70 76 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
r5809 r5851 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; … … 45 46 46 47 public override IOperation Apply() { 48 var solution = SymbolicExpressionTreeParameter.ActualValue; 47 49 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 49 Quality = new DoubleValue(quality); 50 51 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 52 QualityParameter.ActualValue = new DoubleValue(quality); 53 AddEvaluatedNodes(solution.Length * rows.Count()); 54 50 55 return base.Apply(); 51 56 } … … 61 66 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 62 67 EstimationLimitsParameter.ExecutionContext = context; 68 EvaluatedNodesParameter.ExecutionContext = context; 63 69 64 70 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 65 71 72 AddEvaluatedNodes(tree.Length * rows.Count()); 73 66 74 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 67 75 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null; 68 77 69 78 return mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r5846 r5851 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Collections.Generic; 24 25 using HeuristicLab.Common; … … 46 47 47 48 public override IOperation Apply() { 49 var solution = SymbolicExpressionTreeParameter.ActualValue; 48 50 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 50 Quality = new DoubleValue(quality); 51 52 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 53 QualityParameter.ActualValue = new DoubleValue(quality); 54 AddEvaluatedNodes(solution.Length * rows.Count()); 55 51 56 return base.Apply(); 52 57 } … … 62 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 63 68 EstimationLimitsParameter.ExecutionContext = context; 69 EvaluatedNodesParameter.ExecutionContext = context; 64 70 65 71 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 72 AddEvaluatedNodes(tree.Length * rows.Count()); 66 73 67 74 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 68 75 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null; 69 77 70 78 return r2; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
r5823 r5851 44 44 private const string EvaluationPartitionParameterName = "EvaluationPartition"; 45 45 private const string RelativeNumberOfEvaluatedSamplesParameterName = "RelativeNumberOfEvaluatedSamples"; 46 private const string EvaluatedNodesParameterName = "EvaluatedNodes"; 46 47 47 48 public override bool CanChangeName { get { return false; } } … … 56 57 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 57 58 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 59 } 60 public ILookupParameter<DoubleValue> EvaluatedNodesParameter { 61 get { return (ILookupParameter<DoubleValue>)Parameters[EvaluatedNodesParameterName]; } 58 62 } 59 63 public IValueLookupParameter<T> ProblemDataParameter { … … 83 87 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree.")); 84 88 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic data analysis solution encoded as a symbolic expression tree.")); 89 Parameters.Add(new LookupParameter<DoubleValue>(EvaluatedNodesParameterName, "The total number of evaluated symbolic expression tree nodes.")); 85 90 Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated.")); 86 91 Parameters.Add(new ValueLookupParameter<IntRange>(EvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated.")); … … 102 107 .Where(i => i < testPartitionStart || testPartitionEnd <= i); 103 108 } 109 110 protected void AddEvaluatedNodes(double numberOfNodes) { 111 if (EvaluatedNodesParameter.ActualValue == null) EvaluatedNodesParameter.ActualValue = new DoubleValue(); 112 double curEvaluatedNodes = EvaluatedNodesParameter.ActualValue.Value; 113 EvaluatedNodesParameter.ActualValue = new DoubleValue(curEvaluatedNodes + numberOfNodes); 114 } 104 115 } 105 116 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisSingleObjectiveEvaluator.cs
r5809 r5851 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 39 40 #endregion 40 41 #region properties 41 public DoubleValue Quality {42 get { return QualityParameter.ActualValue; }43 set { QualityParameter.ActualValue = value; }44 }45 42 public abstract bool Maximization { get; } 46 43 #endregion … … 56 53 } 57 54 58 59 55 public abstract double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows); 60 56 }
Note: See TracChangeset
for help on using the changeset viewer.