Skip to main content
Version: v0.67.0

Request Prediction Intervals

This page describes how to request prediction intervals when scoring.

Example Usage for Data Frames

import h2o_mlops_scoring_client
import pandas
DATA_FRAME = pandas.read_csv("/Users/jgranados/datasets/BNPParibas.csv")
ID_COLUMN = "ID"
MLOPS_ENDPOINT_URL = "https://model.internal.dedicated.h2o.ai/aa7a5860-cfb5-4c5a-948c-85a81a061c0d/model/score"

h2o_mlops_scoring_client.score_data_frame(
mlops_endpoint_url=MLOPS_ENDPOINT_URL,
data_frame=DATA_FRAME,
id_column=ID_COLUMN,
request_prediction_intervals=True
)
24/02/27 16:45:14 INFO h2o_mlops_scoring_client: Connecting to H2O.ai MLOps scorer at 'https://model.internal.dedicated.h2o.ai/aa7a5860-cfb5-4c5a-948c-85a81a061c0d/model/score'
24/02/27 16:45:15 INFO h2o_mlops_scoring_client: Starting scoring data frame
24/02/27 16:45:47 INFO h2o_mlops_scoring_client: Scoring complete
24/02/27 16:45:47 INFO h2o_mlops_scoring_client: Total run time: 0:00:33
24/02/27 16:45:47 INFO h2o_mlops_scoring_client: Scoring run time: 0:00:32
IDtargettarget.lowertarget.upper
030.8618400.0682841.293299
140.701454-0.0921011.132914
250.7948550.0012991.226315
360.9507340.1571781.382193
480.9561760.1626201.387635
...............
1143162287080.9136210.1200651.345081
1143172287100.9353380.1417821.366797
1143182287110.9692230.1756671.400683
1143192287120.767552-0.0260041.199012
1143202287130.8872240.0936681.318683

Example Usage for Source/Sink

import h2o_mlops_scoring_client
ID_COLUMN = "ID"
MLOPS_ENDPOINT_URL = "https://model.internal.dedicated.h2o.ai/aa7a5860-cfb5-4c5a-948c-85a81a061c0d/model/score"
SOURCE_DATA = "file:///Users/jgranados/datasets/BNPParibas.csv"
SINK_LOCATION = "file:///Users/jgranados/datasets/output/"
SOURCE_FORMAT = h2o_mlops_scoring_client.Format.CSV
SINK_FORMAT = h2o_mlops_scoring_client.Format.CSV
SINK_WRITE_MODE = h2o_mlops_scoring_client.WriteMode.OVERWRITE

def preprocess(spark_df):
return spark_df.repartition(30)

h2o_mlops_scoring_client.score_source_sink(
mlops_endpoint_url=MLOPS_ENDPOINT_URL,
id_column=ID_COLUMN,
source_data=SOURCE_DATA,
source_format=SOURCE_FORMAT,
sink_location=SINK_LOCATION,
sink_format=SINK_FORMAT,
sink_write_mode=SINK_WRITE_MODE,
preprocess_method=preprocess,
request_prediction_intervals=True
)
24/02/27 16:45:49 INFO h2o_mlops_scoring_client: Connecting to H2O.ai MLOps scorer at 'https://model.internal.dedicated.h2o.ai/aa7a5860-cfb5-4c5a-948c-85a81a061c0d/model/score'
24/02/27 16:45:52 INFO h2o_mlops_scoring_client: Applying preprocess method
24/02/27 16:45:52 INFO h2o_mlops_scoring_client: Starting scoring from 'file:///Users/jgranados/datasets/BNPParibas.csv' to 'file:///Users/jgranados/datasets/output/'
24/02/27 16:46:16 INFO h2o_mlops_scoring_client: Scoring complete
24/02/27 16:46:16 INFO h2o_mlops_scoring_client: Total run time: 0:00:29
24/02/27 16:46:16 INFO h2o_mlops_scoring_client: Scoring run time: 0:00:24

Feedback