Tutorial 1A: Realtime scoring with the Python client
The following tutorial describes how to use the H2O eScorer Python client to make predictions on data in real-time. The client is light-weight and concurrent, so you can score tens of thousands of rows in less than ten lines of code. Deploying machine learning models on H2O eScorer is easy with the drag-and-drop upload option in the Wave app.
Install the Python client
You can download the H2O eScorer Python client wheel from the Python client tab in the H2O eScorer downloads page.
In your Python environment, run the following command to install the package and its dependencies:
pip install <python-client-wheel-name>
Authentication
H2O eScorer environment variables for authentication are set just once, and can be automatically used by the client for as many runs as you want.
For more information about authenticating the Python client, see Python client overview: Authentication
In your Python environment, run the following to set the environment variables:
export HAIC_ESCORER_URL = 'https://rest...'
export HAIC_AUTH_URL = 'https://auth...'
export HAIC_ESCORER_URL = '...'
export HAIC_ESCORER_URL = '...'
export HAIC_ESCORER_URL = '...'
Score
The following code demonstrates how to make predictions on the dataset lendingclub.csv
using the model riskmodel.mojo
.
import h2o_escorer
client = h2o_escorer.Client()
response = await client.realtime_scorer(
model_name='riskmodel.mojo',
dataset_filepath='lendingclub.csv',
)
You can access the predictions from the response
object as a Pandas DataFrame:
response['predictions']
To see the client in action for real-time scoring, see Python client usage.
ModelStats
H2O eScorer Wave app provides a live dashboard with realtime updates to view ModelStats as models are scored.
- Submit and view feedback for this page
- Send feedback about H2O eScorer to cloud-feedback@h2o.ai