Changeset 5906 for trunk/sources
- Timestamp:
- 03/31/11 11:22:28 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System.Linq;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Common; … … 50 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 51 50 QualitiesParameter.ActualValue = new DoubleArray(qualities); 52 AddEvaluatedNodes(solution.Length * rows.Count());53 51 return base.Apply(); 54 52 } … … 67 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 68 66 EstimationLimitsParameter.ExecutionContext = context; 69 EvaluatedNodesParameter.ExecutionContext = context;70 67 71 68 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 72 AddEvaluatedNodes(tree.Length * rows.Count());73 69 74 70 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 75 71 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null;77 72 78 73 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5894 r5906 1 using System; 2 using System.Linq; 3 using System.Collections.Generic; 1 using System.Collections.Generic; 4 2 using HeuristicLab.Common; 5 3 using HeuristicLab.Core; … … 30 28 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 31 29 QualitiesParameter.ActualValue = new DoubleArray(qualities); 32 AddEvaluatedNodes(solution.Length * rows.Count());33 30 return base.Apply(); 34 31 } … … 47 44 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 48 45 EstimationLimitsParameter.ExecutionContext = context; 49 EvaluatedNodesParameter.ExecutionContext = context;50 46 51 47 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 52 AddEvaluatedNodes(tree.Length * rows.Count()); 53 48 54 49 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 55 50 EstimationLimitsParameter.ExecutionContext = null; 56 EvaluatedNodesParameter.ExecutionContext = null;57 51 58 52 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs
r5894 r5906 49 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());52 51 return base.Apply(); 53 52 } … … 90 89 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 91 90 EstimationLimitsParameter.ExecutionContext = context; 92 EvaluatedNodesParameter.ExecutionContext = context;93 91 94 92 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 95 AddEvaluatedNodes(tree.Length * rows.Count());96 93 97 94 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 98 95 EstimationLimitsParameter.ExecutionContext = null; 99 EvaluatedNodesParameter.ExecutionContext = null;100 96 101 97 return mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System.Linq;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Common; … … 50 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 51 50 QualityParameter.ActualValue = new DoubleValue(quality); 52 AddEvaluatedNodes(solution.Length * rows.Count());53 51 return base.Apply(); 54 52 } … … 67 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 68 66 EstimationLimitsParameter.ExecutionContext = context; 69 EvaluatedNodesParameter.ExecutionContext = context;70 67 71 68 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 72 AddEvaluatedNodes(tree.Length * rows.Count());73 69 74 70 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 75 71 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null;77 72 78 73 return mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System;23 using System.Linq;24 22 using System.Collections.Generic; 25 23 using HeuristicLab.Common; … … 51 49 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 52 50 QualityParameter.ActualValue = new DoubleValue(quality); 53 AddEvaluatedNodes(solution.Length * rows.Count());54 51 return base.Apply(); 55 52 } … … 67 64 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 68 65 EstimationLimitsParameter.ExecutionContext = context; 69 EvaluatedNodesParameter.ExecutionContext = context;70 66 71 67 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 72 AddEvaluatedNodes(tree.Length * rows.Count());73 68 74 69 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 75 70 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null;77 71 78 72 return r2; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System.Linq;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Common; … … 50 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 51 50 QualitiesParameter.ActualValue = new DoubleArray(qualities); 52 AddEvaluatedNodes(solution.Length * rows.Count());53 51 return base.Apply(); 54 52 } … … 67 65 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 68 66 EstimationLimitsParameter.ExecutionContext = context; 69 EvaluatedNodesParameter.ExecutionContext = context;70 67 71 68 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 72 AddEvaluatedNodes(tree.Length * rows.Count());73 69 74 70 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 75 71 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null;77 72 78 73 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System;23 using System.Linq;24 22 using System.Collections.Generic; 25 23 using HeuristicLab.Common; … … 51 49 double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 52 50 QualitiesParameter.ActualValue = new DoubleArray(qualities); 53 AddEvaluatedNodes(solution.Length * rows.Count());54 51 return base.Apply(); 55 52 } … … 67 64 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 68 65 EstimationLimitsParameter.ExecutionContext = context; 69 EvaluatedNodesParameter.ExecutionContext = context;70 66 71 67 double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 72 AddEvaluatedNodes(tree.Length * rows.Count());73 68 74 69 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 75 70 EstimationLimitsParameter.ExecutionContext = null; 76 EvaluatedNodesParameter.ExecutionContext = null;77 71 78 72 return quality; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System.Linq;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Common; … … 51 50 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 52 51 QualityParameter.ActualValue = new DoubleValue(quality); 53 AddEvaluatedNodes(solution.Length * rows.Count());54 52 55 53 return base.Apply(); … … 69 67 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 70 68 EstimationLimitsParameter.ExecutionContext = context; 71 EvaluatedNodesParameter.ExecutionContext = context;72 69 73 70 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 74 71 75 AddEvaluatedNodes(tree.Length * rows.Count());76 72 77 73 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 78 74 EstimationLimitsParameter.ExecutionContext = null; 79 EvaluatedNodesParameter.ExecutionContext = null;80 75 81 76 return mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r5894 r5906 20 20 #endregion 21 21 22 using System;23 using System.Linq;24 22 using System.Collections.Generic; 25 23 using HeuristicLab.Common; … … 52 50 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 53 51 QualityParameter.ActualValue = new DoubleValue(quality); 54 AddEvaluatedNodes(solution.Length * rows.Count());55 52 56 53 return base.Apply(); … … 69 66 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 70 67 EstimationLimitsParameter.ExecutionContext = context; 71 EvaluatedNodesParameter.ExecutionContext = context;72 68 73 69 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows); 74 AddEvaluatedNodes(tree.Length * rows.Count());75 70 76 71 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 77 72 EstimationLimitsParameter.ExecutionContext = null; 78 EvaluatedNodesParameter.ExecutionContext = null;79 73 80 74 return r2; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
r5864 r5906 44 44 private const string EvaluationPartitionParameterName = "EvaluationPartition"; 45 45 private const string RelativeNumberOfEvaluatedSamplesParameterName = "RelativeNumberOfEvaluatedSamples"; 46 private const string EvaluatedNodesParameterName = "EvaluatedNodes";47 46 48 47 public override bool CanChangeName { get { return false; } } … … 57 56 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 58 57 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 59 }60 public ILookupParameter<DoubleValue> EvaluatedNodesParameter {61 get { return (ILookupParameter<DoubleValue>)Parameters[EvaluatedNodesParameterName]; }62 58 } 63 59 public IValueLookupParameter<T> ProblemDataParameter { … … 87 83 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree.")); 88 84 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."));90 85 Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated.")); 91 86 Parameters.Add(new ValueLookupParameter<IntRange>(EvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated.")); … … 107 102 .Where(i => i < testPartitionStart || testPartitionEnd <= i); 108 103 } 109 110 protected void AddEvaluatedNodes(double numberOfNodes) {111 if (EvaluatedNodesParameter.ActualValue == null) {112 // variable for evaluated nodes does not exist yet113 // search global scope114 var scope = ExecutionContext.Scope;115 while (scope.Parent != null) scope = scope.Parent;116 // add variable into global scope117 scope.Variables.Add(new HeuristicLab.Core.Variable(EvaluatedNodesParameter.ActualName, new DoubleValue()));118 }119 double curEvaluatedNodes = EvaluatedNodesParameter.ActualValue.Value;120 EvaluatedNodesParameter.ActualValue = new DoubleValue(curEvaluatedNodes + numberOfNodes);121 }122 104 } 123 105 }
Note: See TracChangeset
for help on using the changeset viewer.