- Timestamp:
- 01/10/10 21:01:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ArtificialNeuralNetworks/3.2/Predictor.cs
r2562 r2619 37 37 } 38 38 39 public override double[]Predict(Dataset input, int start, int end) {39 public override IEnumerable<double> Predict(Dataset input, int start, int end) { 40 40 41 41 if (start < 0 || end <= start) throw new ArgumentException("start must be larger than zero and strictly smaller than end"); 42 42 if (end > input.Rows) throw new ArgumentOutOfRangeException("number of rows in input is smaller then end"); 43 double[] result = new double[end - start]; 44 for (int i = 0; i < result.Length; i++) { 45 try { 46 double[] output = new double[1]; 47 double[] inputRow = new double[input.Columns - 1]; 48 for (int c = 1; c < inputRow.Length; c++) { 49 inputRow[c - 1] = input.GetValue(i + start, c); 50 } 51 alglib.mlpbase.multilayerperceptron p = perceptron.Perceptron; 52 alglib.mlpbase.mlpprocess(ref p, ref inputRow, ref output); 53 perceptron.Perceptron = p; 54 result[i] = Math.Max(Math.Min(output[0], UpperPredictionLimit), LowerPredictionLimit); 43 44 for (int i = 0; i < end - start; i++) { 45 double[] output = new double[1]; 46 double[] inputRow = new double[input.Columns - 1]; 47 for (int c = 1; c < inputRow.Length; c++) { 48 inputRow[c - 1] = input.GetValue(i + start, c); 55 49 } 56 catch (ArgumentException) { 57 result[i] = double.NaN; 58 } 50 alglib.mlpbase.multilayerperceptron p = perceptron.Perceptron; 51 alglib.mlpbase.mlpprocess(ref p, ref inputRow, ref output); 52 perceptron.Perceptron = p; 53 yield return Math.Max(Math.Min(output[0], UpperPredictionLimit), LowerPredictionLimit); 59 54 } 60 return result;61 55 } 62 56
Note: See TracChangeset
for help on using the changeset viewer.