Changeset 2619 for trunk/sources/HeuristicLab.GP.StructureIdentification
- Timestamp:
- 01/10/10 21:01:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Predictor.cs ¶
r2567 r2619 29 29 using System.Xml; 30 30 using HeuristicLab.DataAnalysis; 31 using System.Linq; 31 32 32 33 namespace HeuristicLab.GP.StructureIdentification { … … 50 51 } 51 52 52 public override double[]Predict(Dataset input, int start, int end) {53 public override IEnumerable<double> Predict(Dataset input, int start, int end) { 53 54 treeEvaluator.UpperEvaluationLimit = UpperPredictionLimit; 54 55 treeEvaluator.LowerEvaluationLimit = LowerPredictionLimit; … … 56 57 if (start < 0 || end <= start) throw new ArgumentException("start must be larger than zero and strictly smaller than end"); 57 58 if (end > input.Rows) throw new ArgumentOutOfRangeException("number of rows in input is smaller then end"); 58 treeEvaluator.PrepareForEvaluation(input, functionTree.FunctionTree); 59 double[] result = new double[end - start]; 60 for (int i = 0; i < result.Length; i++) { 61 try { 62 result[i] = treeEvaluator.Evaluate(i + start); 63 } 64 catch (ArgumentException) { 65 result[i] = double.NaN; 66 } 67 } 68 return result; 59 return treeEvaluator.Evaluate(input, functionTree.FunctionTree, Enumerable.Range(start, end - start)); 69 60 } 70 61
Note: See TracChangeset
for help on using the changeset viewer.