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
Import the H2O eScorer client
import h2o_escorer
import asyncio
Add the async function main to authenticate and score
async def main():
# Init the escorer client
client = h2o_escorer.Client()
# Authenticate the client
await client.authenticate()
# Score model in realtime
response = await client.realtime_scorer(
model_name='pipeline.mojo',
dataset_filepath='<path_to_dataset>',
progress=True
)
return response
Call the main function asynchronously
response = await main()
Get the predictions
response['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
Get the number of rows scored
response['rows_produced']
1000
Get the scoring latency
f'{response["time_elapsed"]}s'
'4.497s'
Feedback
- Submit and view feedback for this page
- Send feedback about H2O eScorer to cloud-feedback@h2o.ai