Batch scoring
This example demonstrates how to use the eScorer Python client for batch scoring. You can download the complete example here.
Batch scoring with the Python client
After authenticating the client, you can use the batch_scorer
method to perform batch scoring.
The batch_scorer
method takes the model name and the properties file path as arguments. The properties
file contains the configuration for the batch scoring job. The batch_job
object is returned, which can be used to monitor the progress of the batch scoring job.
For information on how to autogenerate and populate a properties
file to configure batch scoring, see Batch scoring configuration and usage.
batch_job = await client.scorer.batch.create(
model_name='<model_name>',
properties_filepath='/path/to/file.properties',
verbose=True,
)
Get job ID
Each batch scoring job has a unique ID which can be used to monitor the progress of the job.
batch_job.id
UUID('09e5042c-096a-4ee7-9bd6-182ef7457298')
Check if the job is complete
The is_complete()
method will become a property in the next release.
await batch_job.is_complete()
True
Get the logs
await batch_job.get_logs()
['****** AWS *******',
'Thread-3 BAD DATA Too Many Features ROW: = 31487,3500, 36 months,7.74,109.27,9,31200,"Not,Verified",MN,5.73,,1092,9.9,12 Len:15 Features:13 Offset: 1',
'Thread-3 Model has 13 features but after parsing feature count is 15 check field seperator or maybe the data contains a default seperator.',
'Total selected rows 39029 Total Read time (ms) 16056',
'Thread-1 Rows Read 19644 Scored 19644 Error 0 Queue Empty true',
'Thread-3 Rows Read 19385 Scored 19384 Error 1 Queue Empty true',
'Upload of file escorer/predictions-2024-05-28-07-51-58.csv to S3 completed']
Get job information
batch_job.created_at
2025-01-29 02:45:30 PM +0000
batch_job.last_modified_at
2025-01-29 02:46:00 PM +0000
Get all jobs
All batch scoring jobs can be retrieved using the list()
method.
await client.scorer.batch.list()
[BatchJob(job_id=1fbd0609-5abb-4ccd-92ae-893426a129fc, created_at=2025-01-29 02:45:30 PM +0530, last_modified_at=2025-01-29 02:45:47 PM +0530),
BatchJob(job_id=8db2989a-0cd7-4b7d-9d5e-9f05f8f846c6, created_at=2025-01-07 04:27:17 PM +0530, last_modified_at=2025-01-07 04:27:21 PM +0530),
BatchJob(job_id=5f21eeff-854a-4c87-aea8-defabb7cf2cd, created_at=2025-01-07 04:27:12 PM +0530, last_modified_at=2025-01-07 04:27:15 PM +0530)]
- Submit and view feedback for this page
- Send feedback about H2O eScorer to cloud-feedback@h2o.ai