Changeset 2578
- Timestamp:
- 01/02/10 18:10:15 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ClassificationMeanSquaredErrorEvaluator.cs
r2328 r2578 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.GP.Interfaces; 27 using System.Linq; 28 using HeuristicLab.DataAnalysis; 26 29 27 30 namespace HeuristicLab.GP.StructureIdentification.Classification { … … 40 43 } 41 44 42 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {45 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) { 43 46 double errorsSquaredSum = 0; 47 double[] estimatedValues = evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray(); 44 48 for (int sample = start; sample < end; sample++) { 45 double estimated = evaluator.Evaluate(sample);46 49 double original = dataset.GetValue(sample, targetVariable); 47 50 if (!double.IsNaN(original) && !double.IsInfinity(original)) { 48 double error = estimated - original;51 double error = estimatedValues[sample - start] - original; 49 52 // between classes use squared error 50 53 // on the lower end and upper end only add linear error if the absolute error is larger than 1 … … 57 60 } 58 61 } 62 59 63 } 60 64 -
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/GPClassificationEvaluatorBase.cs
r2577 r2578 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.DataAnalysis; 26 using HeuristicLab.GP.Interfaces; 26 27 27 28 namespace HeuristicLab.GP.StructureIdentification.Classification { … … 33 34 } 34 35 35 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {36 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 36 37 37 38 ItemList<DoubleData> classes = GetVariableValue<ItemList<DoubleData>>("TargetClassValues", scope, true); 38 39 double[] classesArr = new double[classes.Count]; 39 for (int i = 0; i < classesArr.Length; i++) classesArr[i] = classes[i].Data;40 for (int i = 0; i < classesArr.Length; i++) classesArr[i] = classes[i].Data; 40 41 Array.Sort(classesArr); 41 42 double[] thresholds = new double[classes.Count - 1]; 42 for (int i = 0; i < classesArr.Length - 1; i++) {43 for (int i = 0; i < classesArr.Length - 1; i++) { 43 44 thresholds[i] = (classesArr[i] + classesArr[i + 1]) / 2.0; 44 45 } 45 46 46 Evaluate(scope, evaluator, dataset, targetVariable, classesArr, thresholds, start, end);47 Evaluate(scope, tree, evaluator, dataset, targetVariable, classesArr, thresholds, start, end); 47 48 } 48 49 49 public abstract void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end);50 public abstract void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end); 50 51 } 51 52 } -
trunk/sources/HeuristicLab.GP.StructureIdentification.ConditionalEvaluation/3.3/ConditionalEvaluatorBase.cs
r2577 r2578 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.DataAnalysis; 29 using HeuristicLab.GP.Interfaces; 30 using HeuristicLab.Modeling; 29 31 30 32 namespace HeuristicLab.GP.StructureIdentification.ConditionalEvaluation { … … 40 42 } 41 43 42 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {44 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 43 45 int maxTimeOffset = GetVariableValue<IntData>("MaxTimeOffset", scope, true).Data; 44 46 int minTimeOffset = GetVariableValue<IntData>("MinTimeOffset", scope, true).Data; 45 47 int conditionVariable = GetVariableValue<IntData>("ConditionVariable", scope, true).Data; 46 48 47 int skippedSampels = 0; 49 var rows = from row in Enumerable.Range(start, end - start) 50 // check if condition variable is true between sample - minTimeOffset and sample - maxTimeOffset 51 // => select rows where the value of the condition variable is different from zero in the whole range 52 where (from neighbour in Enumerable.Range(row + minTimeOffset, maxTimeOffset - minTimeOffset) 53 let value = dataset.GetValue(neighbour, conditionVariable) 54 where value == 0 55 select neighbour).Any() == false 56 select row; 57 48 58 // store original and estimated values in a double array 49 double[,] values = new double[end - start, 2]; 50 for (int sample = start; sample < end; sample++) { 51 // check if condition variable is true between sample - minTimeOffset and sample - maxTimeOffset 52 bool skip = false; 53 for (int checkIndex = sample + minTimeOffset; checkIndex <= sample + maxTimeOffset && !skip; checkIndex++) { 54 if (dataset.GetValue(checkIndex, conditionVariable) == 0) { 55 skip = true; 56 skippedSampels++; 57 } 58 } 59 if (!skip) { 60 double original = dataset.GetValue(sample, targetVariable); 61 double estimated = evaluator.Evaluate(sample); 62 63 values[sample - start - skippedSampels, 0] = estimated; 64 values[sample - start - skippedSampels, 1] = original; 65 } 66 } 67 //needed because otherwise the array is too large and therefore the sample count is incorrect during calculation 68 ResizeArray(ref values, 2, end - start - skippedSampels); 69 59 double[,] values = Matrix<double>.Create( 60 evaluator.Evaluate(dataset, tree, rows).ToArray(), 61 (from row in rows select dataset.GetValue(row, targetVariable)).ToArray()); 70 62 71 63 // calculate quality value … … 78 70 } 79 71 qualityData.Data = quality; 80 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data -= skippedSampels; 81 } 82 83 84 private void ResizeArray(ref double[,] original, int cols, int rows) { 85 double[,] newArray = new double[rows, cols]; 86 Array.Copy(original, newArray, cols * rows); 87 original = newArray; 72 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data -= (end - start) - rows.Count(); 88 73 } 89 74 -
trunk/sources/HeuristicLab.GP.StructureIdentification.ConditionalEvaluation/3.3/ConditionalSimpleEvaluator.cs
r2577 r2578 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.DataAnalysis; 29 using HeuristicLab.GP.Interfaces; 29 30 30 31 namespace HeuristicLab.GP.StructureIdentification.ConditionalEvaluation { … … 38 39 } 39 40 40 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {41 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 41 42 ItemList values = GetVariableValue<ItemList>("Values", scope, false, false); 42 43 if (values == null) { … … 53 54 int minTimeOffset = GetVariableValue<IntData>("MinTimeOffset", scope, true).Data; 54 55 int conditionVariable = GetVariableValue<IntData>("ConditionVariable", scope, true).Data; 55 int skippedSampels = 0;56 56 57 for (int sample = start; sample < end; sample++) { 58 // check if condition variable is true between sample - minTimeOffset and sample - maxTimeOffset 59 bool skip = false; 60 for (int checkIndex = sample + minTimeOffset; checkIndex <= sample + maxTimeOffset && !skip ; checkIndex++) { 61 if (dataset.GetValue(checkIndex, conditionVariable) == 0) { 62 skip = true; 63 skippedSampels++; 64 } 65 } 66 if (!skip) { 67 ItemList row = new ItemList(); 68 double estimated = evaluator.Evaluate(sample); 69 double original = dataset.GetValue(sample, targetVariable); 70 71 row.Add(new DoubleData(estimated)); 72 row.Add(new DoubleData(original)); 73 values.Add(row); 74 } 57 var rows = from row in Enumerable.Range(start, end - start) 58 // check if condition variable is true between sample - minTimeOffset and sample - maxTimeOffset 59 // => select rows where the value of the condition variable is different from zero in the whole range 60 where (from neighbour in Enumerable.Range(row + minTimeOffset, maxTimeOffset - minTimeOffset) 61 let value = dataset.GetValue(neighbour, conditionVariable) 62 where value == 0 63 select neighbour).Any() == false 64 select row; 65 66 67 double[] estimatedValues = evaluator.Evaluate(dataset, tree, rows).ToArray(); 68 double[] originalValues = (from row in rows select dataset.GetValue(row, targetVariable)).ToArray(); 69 for (int i = 0; i < rows.Count(); i++) { 70 ItemList row = new ItemList(); 71 row.Add(new DoubleData(estimatedValues[i])); 72 row.Add(new DoubleData(originalValues[i])); 73 values.Add(row); 75 74 } 76 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data -= skippedSampels; 75 76 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data -= (end - start) - rows.Count(); 77 77 } 78 78 } -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/AveragePercentageChangeEvaluator.cs
r2577 r2578 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.GP.Interfaces; 26 using HeuristicLab.DataAnalysis; 27 using System.Linq; 25 28 26 29 namespace HeuristicLab.GP.StructureIdentification.TimeSeries { … … 38 41 } 39 42 40 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {43 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 41 44 bool differential = GetVariableValue<BoolData>("Differential", scope, true).Data; 42 45 DoubleData apc = GetVariableValue<DoubleData>("APC", scope, false, false); … … 47 50 48 51 double percentageSum = 0; 49 for (int sample = start; sample < end; sample++) { 52 double[] estimatedValues = evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray(); 53 double[] originalValues = dataset.GetVariableValues(targetVariable, start - 1, end); 54 for (int i = 0; i < estimatedValues.Length; i++) { 50 55 double prevOriginal; 51 56 double originalPercentageChange; 52 57 double estimatedPercentageChange; 53 58 if (differential) { 54 prevOriginal = dataset.GetValue(sample - 1, targetVariable);55 originalPercentageChange = ( dataset.GetValue(sample, targetVariable)- prevOriginal) / prevOriginal;56 estimatedPercentageChange = (e valuator.Evaluate(sample)- prevOriginal) / prevOriginal;57 59 prevOriginal = originalValues[i]; 60 originalPercentageChange = (originalValues[i + 1] - prevOriginal) / prevOriginal; 61 estimatedPercentageChange = (estimatedValues[i] - prevOriginal) / prevOriginal; 62 58 63 } else { 59 originalPercentageChange = dataset.GetValue(sample, targetVariable);60 estimatedPercentageChange = e valuator.Evaluate(sample);61 64 originalPercentageChange = originalValues[i + 1]; 65 estimatedPercentageChange = estimatedValues[i]; 66 62 67 } 63 68 if (!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) { -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/ProfitEvaluator.cs
r2577 r2578 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using HeuristicLab.GP.Interfaces; 25 using HeuristicLab.DataAnalysis; 26 using System.Linq; 24 27 25 28 namespace HeuristicLab.GP.StructureIdentification.TimeSeries { … … 38 41 } 39 42 40 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {43 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 41 44 int exchangeRateVarIndex = GetVariableValue<IntData>("ExchangeRate", scope, true).Data; 42 45 double transactionCost = GetVariableValue<DoubleData>("TransactionCost", scope, true).Data; … … 50 53 double cB = 0; 51 54 double exchangeRate = double.MaxValue; 52 for (int sample = start; sample < end; sample++) { 53 exchangeRate = dataset.GetValue(sample, exchangeRateVarIndex); 54 double originalPercentageChange = dataset.GetValue(sample, targetVariable); 55 double estimatedPercentageChange = evaluator.Evaluate(sample); 56 55 double[] estimatedValues = evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray(); 56 double[] originalValues = dataset.GetVariableValues(targetVariable, start, end); 57 double[] exchangeRateValues = dataset.GetVariableValues(exchangeRateVarIndex, start, end); 58 for (int i = 0; i < estimatedValues.Length; i++) { 59 exchangeRate = exchangeRateValues[i]; 60 double originalPercentageChange = originalValues[i]; 61 double estimatedPercentageChange = estimatedValues[i]; 62 57 63 if (!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) { 58 64 if (estimatedPercentageChange > 0) { -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/TreeEvaluatorBase.cs
r2364 r2578 60 60 } 61 61 62 public void PrepareForEvaluation(Dataset dataset, IFunctionTree functionTree) { 62 [Obsolete] 63 public virtual void PrepareForEvaluation(Dataset dataset, IFunctionTree functionTree) { 63 64 this.dataset = dataset; 64 65 codeArr = new Instr[functionTree.GetSize()]; … … 94 95 } 95 96 96 public double Evaluate(int sampleIndex) { 97 [Obsolete] 98 public virtual double Evaluate(int sampleIndex) { 97 99 PC = 0; 98 100 this.sampleIndex = sampleIndex; … … 101 103 if (double.IsNaN(estimated)) estimated = UpperEvaluationLimit; 102 104 return estimated; 105 } 106 107 public virtual IEnumerable<double> Evaluate(Dataset dataset, IFunctionTree tree, IEnumerable<int> rows) { 108 PrepareForEvaluation(dataset, tree); 109 foreach (int row in rows) 110 yield return Evaluate(row); 103 111 } 104 112 -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/EarlyStoppingMeanSquaredErrorEvaluator.cs
r2577 r2578 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using System; 25 using HeuristicLab.GP.Interfaces; 26 using HeuristicLab.DataAnalysis; 27 using System.Collections; 28 using System.Collections.Generic; 29 using System.Linq; 24 30 25 31 namespace HeuristicLab.GP.StructureIdentification { … … 39 45 40 46 // evaluates the function-tree for the given target-variable and the whole dataset and returns the MSE 41 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {47 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 42 48 double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, true).Data; 43 49 DoubleData mse = GetVariableValue<DoubleData>("MSE", scope, false, false); … … 46 52 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("MSE"), mse)); 47 53 } 48 49 54 double errorsSquaredSum = 0; 50 55 int rows = end - start; 51 56 int n = 0; 52 for (int sample = start; sample < end; sample++) {53 double estimated = evaluator.Evaluate(sample);57 int sample = start; 58 foreach (var estimatedValue in evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start))) { 54 59 double original = dataset.GetValue(sample, targetVariable); 55 60 56 61 if (!double.IsNaN(original) && !double.IsInfinity(original)) { 57 double error = estimated - original;62 double error = estimatedValue - original; 58 63 errorsSquaredSum += error * error; 59 64 n++; 60 65 } 61 // check the limit and stop as soon as we hit the limit62 if ( errorsSquaredSum / rows >= qualityLimit) {66 // check the limit every 30 samples and stop as soon as we hit the limit 67 if (n % 30 == 29 && errorsSquaredSum / rows >= qualityLimit) { 63 68 mse.Data = errorsSquaredSum / (n + 1); // return estimated MSE (when the remaining errors are on average the same) 64 69 return; 65 70 } 71 sample++; 66 72 } 67 73 errorsSquaredSum /= n; -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/GPEvaluatorBase.cs
r2577 r2578 46 46 int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data; 47 47 int end = GetVariableValue<IntData>("SamplesEnd", scope, true).Data; 48 48 49 ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true); 49 50 evaluator.PrepareForEvaluation(dataset, gpModel.FunctionTree); 51 Evaluate(scope, evaluator, dataset, targetVariable, start, end); 50 Evaluate(scope, gpModel.FunctionTree, evaluator, dataset, targetVariable, start, end); 52 51 53 52 // update the value of total evaluated nodes … … 56 55 } 57 56 58 public abstract void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end);57 public abstract void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end); 59 58 } 60 59 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/NodeBasedVariableImpactCalculator.cs
r2454 r2578 138 138 139 139 private static double CalculateMSE(Dataset dataset, ITreeEvaluator evaluator, IFunctionTree tree, int targetVariable, int start, int end) { 140 double[,] values = new double[end - start, 2]; 141 evaluator.PrepareForEvaluation(dataset, tree); 142 for (int i = start; i < end; i++) { 143 values[i - start, 0] = dataset.GetValue(i, targetVariable); 144 values[i - start, 1] = evaluator.Evaluate(i); 145 } 140 141 double[,] values = Matrix<double>.Create( 142 dataset.GetVariableValues(targetVariable, start, end), 143 evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray()); 146 144 return SimpleMSEEvaluator.Calculate(values); 147 145 } … … 155 153 156 154 private static double CalculateReplacementValue(Dataset dataset, ITreeEvaluator evaluator, IFunctionTree tree, int targetVariable, int start, int end) { 157 double[] values = new double[end - start]; 158 evaluator.PrepareForEvaluation(dataset, tree); 159 for (int i = start; i < end; i++) { 160 values[i - start] = evaluator.Evaluate(i); 161 } 162 return Statistics.Median(values); 155 return Statistics.Median(evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray()); 163 156 } 164 157 -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleEvaluator.cs
r2577 r2578 23 23 using HeuristicLab.Data; 24 24 using HeuristicLab.DataAnalysis; 25 using HeuristicLab.GP.Interfaces; 26 using HeuristicLab.Modeling; 27 using System.Linq; 25 28 26 29 namespace HeuristicLab.GP.StructureIdentification { … … 31 34 } 32 35 33 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {36 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 34 37 DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, false, false); 35 38 if (values == null) { … … 42 45 } 43 46 44 double[,] v = new double[end - start, 2]; 45 46 for (int sample = start; sample < end; sample++) { 47 double estimated = evaluator.Evaluate(sample); 48 double original = dataset.GetValue(sample, targetVariable); 49 50 v[sample - start, 0] = original; 51 v[sample - start, 1] = estimated; 52 } 47 double[,] v = Matrix<double>.Create( 48 dataset.GetVariableValues(targetVariable, start, end), 49 evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray()); 53 50 values.Data = v; 54 51 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/SimpleGPEvaluatorBase.cs
r2577 r2578 23 23 using HeuristicLab.Data; 24 24 using HeuristicLab.DataAnalysis; 25 using HeuristicLab.Modeling; 26 using HeuristicLab.GP.Interfaces; 27 using System.Linq; 25 28 26 29 namespace HeuristicLab.GP.StructureIdentification { … … 33 36 } 34 37 35 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) {38 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end) { 36 39 // store original and estimated values in a double array 37 double[,] values = new double[end - start, 2]; 38 for (int sample = start; sample < end; sample++) { 39 double original = dataset.GetValue(sample, targetVariable); 40 double estimated = evaluator.Evaluate(sample); 41 42 values[sample - start, 0] = estimated; 43 values[sample - start, 1] = original; 44 } 40 double[,] values = Matrix<double>.Create( 41 dataset.GetVariableValues(targetVariable, start, end), 42 evaluator.Evaluate(dataset, tree, Enumerable.Range(start, end - start)).ToArray()); 45 43 46 44 double quality = Evaluate(values); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/UncertainMeanSquaredErrorEvaluator.cs
r2577 r2578 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.Random; 26 using HeuristicLab.GP.Interfaces; 27 using System.Collections.Generic; 28 using System.Linq; 26 29 27 30 namespace HeuristicLab.GP.StructureIdentification { … … 45 48 46 49 // evaluates the function-tree for the given target-variable and the whole dataset and returns the MSE 47 public override void Evaluate(IScope scope, I TreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) {50 public override void Evaluate(IScope scope, IFunctionTree tree, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end) { 48 51 double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, true).Data; 49 52 int minSamples = GetVariableValue<IntData>("MinEvaluatedSamples", scope, true).Data; … … 72 75 int[] indexes = InitIndexes(mt, start, end); 73 76 int n = 0; 74 for (int sample = 0; sample < rows; sample++) {75 double estimated = evaluator.Evaluate(indexes[sample]);77 int sample = 0; 78 foreach (double estimated in evaluator.Evaluate(dataset, tree, indexes)) { 76 79 double original = dataset.GetValue(indexes[sample], targetVariable); 77 80 if (!double.IsNaN(original) && !double.IsInfinity(original)) { … … 91 94 } 92 95 } 96 sample++; 93 97 } 94 98 -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HL2TreeEvaluator.cs
r2328 r2578 31 31 public HL2TreeEvaluator(double minValue, double maxValue) : base(minValue, maxValue) { } 32 32 33 [Obsolete] 33 34 protected override double EvaluateBakedCode() { 34 35 Instr currInstr = codeArr[PC++]; -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HL3TreeEvaluator.cs
r2449 r2578 33 33 public HL3TreeEvaluator(double minValue, double maxValue) : base(minValue, maxValue) { } 34 34 35 [Obsolete] 35 36 protected override double EvaluateBakedCode() { 36 37 Instr currInstr = codeArr[PC++]; -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/ITreeEvaluator.cs
r2328 r2578 23 23 using HeuristicLab.DataAnalysis; 24 24 using HeuristicLab.GP.Interfaces; 25 using System; 26 using System.Collections.Generic; 25 27 26 28 namespace HeuristicLab.GP.StructureIdentification { … … 28 30 double LowerEvaluationLimit { get; set; } 29 31 double UpperEvaluationLimit { get; set; } 32 [Obsolete] 30 33 void PrepareForEvaluation(Dataset dataset, IFunctionTree functionTree); 34 [Obsolete] 31 35 double Evaluate(int sampleIndex); 36 IEnumerable<double> Evaluate(Dataset dataset, IFunctionTree functionTree, IEnumerable<int> rows); 32 37 } 33 38 }
Note: See TracChangeset
for help on using the changeset viewer.