Skip to main content

Wave ML

Wave ML provides a simple, high-level API for training, deploying, scoring and explaining machine learning models, letting you build predictive and decision-support applications entirely in Python.

You can find the project in a separate repository here.

caution

Wave ML is work in progress and it's not ready for a production use.

Installation#

H2O Wave ML is a companion Python package to H2O Wave (both available on PyPI). Both Wave and Wave ML can be installed in tandem using pip:

(venv) $ pip install h2o-wave[ml]

To use the package, simply import h2o_wave_ml:

import h2o_wave_ml

API Overview#

Wave ML provides four high-level functions:

Use build_model() to train a model. The function accepts a dataset and a target column (the column to be predicted):

from h2o_wave_ml import build_model
model = build_model('./train.csv', target_column='depth')

The call to build_model() automatically determines if the prediction task is classification (predict a category or class) or regression (predict a real value, often a quantity).

Once the model is built, we can get the model's predictions using its predict() method:

from h2o_wave_ml import build_model
model = build_model('./train.csv', target_column='depth')predictions = model.predict(file_path='./test.csv')

You can aso get the model's predictions by directly passing in the test rows:

predictions = model.predict([    ['width', 'height'],    [width1, height1],    [width2, height2],    ...])

To save this model locally, use save_model():

from h2o_wave_ml import build_model, save_model
model = build_model('./train.csv', target_column='depth')model_path = save_model(model, output_dir_path='./')

To load a saved model, use load_model():

model = load_model(model_path)predictions = model.predict(file_path='./test.csv')