ray.train.batch_predictor.BatchPredictor#

class ray.train.batch_predictor.BatchPredictor(checkpoint: ray.air.checkpoint.Checkpoint, predictor_cls: Type[ray.train.predictor.Predictor], **predictor_kwargs)[source]#

Bases: object

Batch predictor class.

Takes a predictor class and a checkpoint and provides an interface to run batch scoring on Datasets.

This batch predictor wraps around a predictor class and executes it in a distributed way when calling predict().

Warning

DEPRECATED: This API is deprecated and may be removed in future Ray releases. BatchPredictor is deprecated from Ray 2.6. Use Dataset.map_batches instead for offline batch inference. For a migration guide, see https://github.com/ray-project/ray/issues/37489. To learn more about batch inference with Ray Data, see http://batchinference.io.

Methods

from_checkpoint(checkpoint, predictor_cls, ...)

Create a BatchPredictor from a Checkpoint.

from_pandas_udf(pandas_udf)

Create a Predictor from a Pandas UDF.

get_preprocessor()

Get the preprocessor to use prior to executing predictions.

predict(data, *[, feature_columns, ...])

Run batch scoring on a Dataset.

predict_pipelined(data, *[, ...])

Setup a prediction pipeline for batch scoring.

set_preprocessor(preprocessor)

Set the preprocessor to use prior to executing predictions.