Open bvandorf opened 2 years ago
Hi,
In the mojo-resource tutorial, you show how to predict from a java application, during my testing I was unable to predict anything other than the default prediction shown in the tutorial even by specifically setting the testRow variable.
https://github.com/h2oai/h2o-tutorials/tree/master/tutorials/mojo-resource
`
URL mojoURL = Main.class.getResource("irisgbm.zip"); MojoReaderBackend reader = MojoReaderBackendFactory.createReaderBackend(mojoURL, MojoReaderBackendFactory.CachingStrategy.MEMORY); MojoModel model = ModelMojoReader.readFrom(reader); EasyPredictModelWrapper modelWrapper = new EasyPredictModelWrapper(model); RowData testRow = new RowData(); for (int i = 0; i < args.length; i++) { testRow.put("C"+i, Double.valueOf(args[i])); } if (testRow.size() == 0) { System.out.println("Add test values to testRow"); testRow.put("C0", 5.1); testRow.put("C1", 3.5); testRow.put("C2", 1.4); testRow.put("C3", 0.2); } System.out.println("C0: " + testRow.get("C0")); System.out.println("C1: " + testRow.get("C1")); System.out.println("C2: " + testRow.get("C2")); System.out.println("C3: " + testRow.get("C3")); System.out.println(""); MultinomialModelPrediction prediction = (MultinomialModelPrediction)modelWrapper.predict(testRow); for (int i = 0; i < prediction.classProbabilities.length; i++) System.out.println(modelWrapper.getResponseDomainValues()[i] + ": "+ prediction.classProbabilities[i]); System.out.println("Prediction: " + prediction.label); System.out.println("Prediction Index: " + prediction.labelIndex);
Hi,
In the mojo-resource tutorial, you show how to predict from a java application, during my testing I was unable to predict anything other than the default prediction shown in the tutorial even by specifically setting the testRow variable.
https://github.com/h2oai/h2o-tutorials/tree/master/tutorials/mojo-resource
`
`