Skip navigation links

Package hex.genmodel.easy

The easy prediction API for generated POJO and MOJO models.

See: Description

Package hex.genmodel.easy Description

The easy prediction API for generated POJO and MOJO models. Use as follows:
  1. Instantiate an EasyPredictModelWrapper
  2. Create a new row of data
  3. Call one of the predict methods

Here is an example:
   
   // Step 1.
   modelClassName = "your_pojo_model_downloaded_from_h2o";
   GenModel rawModel;
   rawModel = (GenModel) Class.forName(modelClassName).newInstance();
   EasyPredictModelWrapper model = new EasyPredictModelWrapper(rawModel);
   //
   // By default, unknown categorical levels throw PredictUnknownCategoricalLevelException.
   // Optionally configure the wrapper to treat unknown categorical levels as N/A instead:
   //
   //     EasyPredictModelWrapper model = new EasyPredictModelWrapper(
   //                                         new EasyPredictModelWrapper.Config()
   //                                             .setModel(rawModel)
   //                                             .setConvertUnknownCategoricalLevelsToNa(true));

   // Step 2.
   RowData row = new RowData();
   row.put(new String("CategoricalColumnName"), new String("LevelName"));
   row.put(new String("NumericColumnName1"), new String("42.0"));
   row.put(new String("NumericColumnName2"), Double.valueOf(42.0));

   // Step 3.
   BinomialModelPrediction p = model.predictBinomial(row);
   
 
Skip navigation links