kumoai.trainer.BatchPredictionJobResult#

class kumoai.trainer.BatchPredictionJobResult[source]#

Bases: object

Represents a completed batch prediction job.

A BatchPredictionJobResult object can either be obtained by creating a BatchPredictionJob object and calling the result() method to await the job’s completion, or by directly creating the object. The former approach is recommended, as it includes verification that the job finished succesfully.

import kumoai

prediction_job = kumoai.BatchPredictionJob("bp-job-...")

# Wait for a batch prediction job's completion, and get its result:
prediction_job_result = prediction_job.result()

# Alternatively, create the result directly, but be sure that the job
# is completed:
prediction_job_result = kumoai.BatchPredictionJobResult("bp-job-...")

# Get associated objects:
prediction_table = prediction_job_result.prediction_table

# Get prediction data (in-memory):
predictions_df = training_job.predictions_df()

# Export prediction data to any output connector:
prediction_job_result.export(
    output_type = ...,
    output_connector = ...,
    output_table_name = ...,
)
__init__(job_id)[source]#
property id: str#

The unique ID of this batch prediction job.

property tracking_url: str#

Returns a tracking URL pointing to the UI display of this batch prediction job.

summary()[source]#

Returns summary statistics associated with the batch prediction job’s output, or raises an exception if summary statistics cannot be obtained.

Return type:

BatchPredictionJobSummary

property prediction_table: Union[PredictionTableJob, PredictionTable]#

Returns the prediction table associated with this prediction job, either as a PredictionTable or a PredictionTableJob depending on the status of the prediction table generation job.

export(output_type, output_connector, output_table_name=None)[source]#

Export the prediction output or the embedding output to the specific output location.

Parameters:
  • output_type (str) – The type of output that should be export by the job. Can be either 'predictions' or 'embeddings'.

  • output_connector (Connector) – The output data source that Kumo should write batch predictions to.

  • output_table_name (Union[str, Tuple, None]) – The name of the table in the output data source that Kumo should write batch predictions to. In the case of a Databricks connector, this should be a tuple of two strings: the schema name and the output prediction table name.

Returns:

The artifact export job id.

Return type:

str

predictions_urls()[source]#

Returns a URL for downloading or reading the predictions.

If Kumo is deployed as a SaaS application, the returned URL will be a presigned AWS S3 URL. If Kumo is deployed as a Snowpark Container Services application, the returned URL will be a Snowflake stage path that can be directly accessed within a Snowflake worksheet.

Return type:

List[str]

predictions_df()[source]#

Returns a DataFrame object representing the generated training data. :rtype: DataFrame

Warning

This method will load the full prediction output into memory as a DataFrame object. If you are working on a machine with limited resources, please use predictions_urls() instead to download the data and perform analysis per-partition.