Real time scoring
This example demonstrates how to use the eScorer Python client for real time scoring. You can download the complete example here.
Prerequisites
Real time scoring with the Python client
After authenticating the client, you can use the realtime_scorer
method to perform real time scoring.
The realtime_scorer
method takes the model name and dataset file path as required input parameters and returns the result of real time scoring.
response = await client.realtime_scorer(
model_name="<model_name>",
dataset_filepath="/path/to/dataset.csv",
skip_header=True,
num_rows=1000,
progress=True
)
Get the predictions
result["predictions"]
bad_loan.0 bad_loan.1
0 0.08621099591255188 0.9137890040874481
1 0.08830222487449646 0.9116977751255035
2 0.03488980233669281 0.9651101976633072
3 0.2397906482219696 0.7602093517780304
4 0.4451645463705063 0.5548354536294937
.. ... ...
995 0.15911102294921875 0.8408889770507812
996 0.03693510591983795 0.963064894080162
997 0.25428231060504913 0.7457176893949509
998 0.1850033551454544 0.8149966448545456
999 0.03011934459209442 0.9698806554079056
[1000 rows x 2 columns]
Get the number of rows scored
result["rows_produced"]
1000
Get the scoring latency
f'{result["time_elapsed"]}s'
135.317s
Feedback
- Submit and view feedback for this page
- Send feedback about H2O eScorer to cloud-feedback@h2o.ai