(double[] point)
| 14 | } |
| 15 | |
| 16 | @Override |
| 17 | public Double predict(double[] point) throws DDFException { |
| 18 | MLClassMethods.PredictMethod predictMethod= new MLClassMethods.PredictMethod(this.getRawModel(), MLClassMethods.DEFAULT_PREDICT_METHOD_NAME, |
| 19 | new Class<?>[]{Vector.class}); |
| 20 | if(predictMethod.getMethod() == null) { |
| 21 | throw new DDFException(String.format("Cannot locate method specified by %s", MLClassMethods.DEFAULT_PREDICT_METHOD_NAME)); |
| 22 | |
| 23 | } |
| 24 | Object prediction = predictMethod.instanceInvoke(Vectors.dense(point)); |
| 25 | if(prediction instanceof Double) { |
| 26 | return (Double) prediction; |
| 27 | } else if (prediction instanceof Integer) { |
| 28 | return ((Integer) prediction).doubleValue(); |
| 29 | } else { |
| 30 | throw new DDFException(String.format("Error getting prediction from model %s", this.getRawModel().getClass().getName())); |
| 31 | } |
| 32 | } |
| 33 | } |
nothing calls this directly
no test coverage detected