Skip to main content

Batch scoring

This example demonstrates how to use the eScorer Python client for batch scoring. You can download the complete example here.

Import the H2O eScorer client

import h2o_escorer 
import asyncio

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
response = await client.batch_scorer(
model_name='pipeline191.mojo',
properties_filepath='artifacts/s3.properties'
)

return response

Asynchronously call score

response = await main()
Running H2O eScorer: Batch. Model: pipeline191.mojo

Get the predictions

response['result']
'Scoring Starting

****** AWS *******
AWS Region US_EAST_1
AWS List Bucket US_EAST_1
Total selected rows 38999 Total Read time (ms) 7058
Thread-1 Rows Read 2473 Scored 2473 Error 0 Queue Empty false
...
Saving results to S3
Upload of file S3/predictions-2022-10-03-14-44-33.csv to S3 completed'

Get the scoring latency

f'{response["time_elapsed"]}s'
'12.829s'

Feedback