- Timestamp:
- 01/10/10 21:01:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SupportVectorMachines/3.2/Predictor.cs
r2436 r2619 66 66 } 67 67 68 public override double[]Predict(Dataset input, int start, int end) {68 public override IEnumerable<double> Predict(Dataset input, int start, int end) { 69 69 if (start < 0 || end <= start) throw new ArgumentException("start must be larger than zero and strictly smaller than end"); 70 70 if (end > input.Rows) throw new ArgumentOutOfRangeException("number of rows in input is smaller then end"); … … 78 78 int targetVariableIndex = input.GetVariableIndex(targetVariable); 79 79 int rows = end - start; 80 double[] result = new double[rows];80 //double[] result = new double[rows]; 81 81 int problemRow = 0; 82 82 for (int resultRow = 0; resultRow < rows; resultRow++) { 83 83 if (double.IsNaN(input.GetValue(resultRow, targetVariableIndex))) 84 result[resultRow] =UpperPredictionLimit;84 yield return UpperPredictionLimit; 85 85 else if (resultRow + maxTimeOffset < 0) { 86 result[resultRow] = UpperPredictionLimit;87 86 problemRow++; 87 yield return UpperPredictionLimit; 88 88 } else { 89 result[resultRow] =Math.Max(Math.Min(SVM.Prediction.Predict(model, scaledProblem.X[problemRow++]), UpperPredictionLimit), LowerPredictionLimit);89 yield return Math.Max(Math.Min(SVM.Prediction.Predict(model, scaledProblem.X[problemRow++]), UpperPredictionLimit), LowerPredictionLimit); 90 90 } 91 91 } 92 return result;93 92 } 94 93
Note: See TracChangeset
for help on using the changeset viewer.