pdstools.infinity.resources.prediction_studio.v24_2

Submodules

Classes

AsyncChampionChallenger

The ChampionChallenger class manages champion and challenger models

ChampionChallenger

The ChampionChallenger class manages champion and challenger models

AsyncDatamartExport

v24.2 DatamartExport business logic — defined once.

DatamartExport

v24.2 DatamartExport business logic — defined once.

AsyncModel

v24.2 Model business logic — defined once.

Model

v24.2 Model business logic — defined once.

AsyncPrediction

Async variant of the v24.2 Prediction.

Prediction

The Prediction class provide functionality including retrieving

AsyncPredictionStudio

v24.2 PredictionStudio business logic — shared parts.

PredictionStudio

v24.2 PredictionStudio business logic — shared parts.

AsyncRepository

v24.2 Repository data — defined once.

Repository

v24.2 Repository data — defined once.

Package Contents

class AsyncChampionChallenger(client, prediction_id: str, active_model, cc_id: str | None = None, context: str | None = None, category: str | None = None, challenger_model=None, champion_percentage: float | None = None, model_objective: str | None = None)

Bases: _ChampionChallengerV24_2Mixin, pdstools.infinity.resources.prediction_studio.base.AsyncChampionChallenger

The ChampionChallenger class manages champion and challenger models within a prediction context. It provides functionalities for:

  • Refreshing champion challenger data

  • Deleting challenger models

  • Promoting challenger models

  • Updating challenger response percentages

  • Adding new models

  • Cloning an ADM active model

  • Adding/removing predictors

Parameters:
  • prediction_id (str)

  • cc_id (str | None)

  • context (str | None)

  • category (str | None)

  • champion_percentage (float | None)

  • model_objective (str | None)

client

The client used to interact with the API.

Type:

Client

prediction_id

The ID of the prediction.

Type:

str

active_model

The active model in the prediction.

Type:

Model

cc_id

The ID of the champion challenger.

Type:

str | None

context

The context of the prediction.

Type:

str | None

category

The category of the prediction.

Type:

str | None

challenger_model

The challenger model.

Type:

Model | None

champion_percentage

The percentage of responses attributed to the champion model.

Type:

float | None

model_objective

The objective of the model.

Type:

str | None

async list_available_models_to_add(return_df: bool = False) pdstools.infinity.internal._pagination.AsyncPaginatedList | polars.DataFrame

Fetches a list of models eligible to be challengers.

Parameters:

return_df (bool, optional) – Determines the format of the returned data: a DataFrame if True, otherwise an async list of model instances. Defaults to False.

Returns:

An async list of model instances or a DataFrame of models.

Return type:

AsyncPaginatedList[AsyncModel] or pl.DataFrame

class ChampionChallenger(client, prediction_id: str, active_model, cc_id: str | None = None, context: str | None = None, category: str | None = None, challenger_model=None, champion_percentage: float | None = None, model_objective: str | None = None)

Bases: _ChampionChallengerV24_2Mixin, pdstools.infinity.resources.prediction_studio.base.ChampionChallenger

The ChampionChallenger class manages champion and challenger models within a prediction context. It provides functionalities for:

  • Refreshing champion challenger data

  • Deleting challenger models

  • Promoting challenger models

  • Updating challenger response percentages

  • Adding new models

  • Cloning an ADM active model

  • Adding/removing predictors

Parameters:
  • prediction_id (str)

  • cc_id (str | None)

  • context (str | None)

  • category (str | None)

  • champion_percentage (float | None)

  • model_objective (str | None)

client

The client used to interact with the API.

Type:

Client

prediction_id

The ID of the prediction.

Type:

str

active_model

The active model in the prediction.

Type:

Model

cc_id

The ID of the champion challenger.

Type:

str | None

context

The context of the prediction.

Type:

str | None

category

The category of the prediction.

Type:

str | None

challenger_model

The challenger model.

Type:

Model | None

champion_percentage

The percentage of responses attributed to the champion model.

Type:

float | None

model_objective

The objective of the model.

Type:

str | None

list_available_models_to_add(return_df: bool = False) pdstools.infinity.internal._pagination.PaginatedList | polars.DataFrame

Fetches a list of models eligible to be challengers.

Queries for models that can be added as challengers to the current prediction for the current active model. Offers the option to return the results in a DataFrame format for easier data handling.

Parameters:

return_df (bool, optional) – Determines the format of the returned data: a DataFrame if True, otherwise a list of model instances. Defaults to False.

Returns:

A list of model instances or a DataFrame of models, based on the return_df parameter choice.

Return type:

PaginatedList[Model] or pl.DataFrame

class AsyncDatamartExport(client, referenceId: str, location: str, repositoryName: str)

Bases: _DatamartExportV24_2Mixin, pdstools.infinity.resources.prediction_studio.base.AsyncDataMartExport

v24.2 DatamartExport business logic — defined once.

Parameters:
  • referenceId (str)

  • location (str)

  • repositoryName (str)

class DatamartExport(client, referenceId: str, location: str, repositoryName: str)

Bases: _DatamartExportV24_2Mixin, pdstools.infinity.resources.prediction_studio.base.DataMartExport

v24.2 DatamartExport business logic — defined once.

Parameters:
  • referenceId (str)

  • location (str)

  • repositoryName (str)

class AsyncModel(client, *, modelId: str, label: str, modelType: str, status: str, componentName: str | None = None, source: str | None = None, lastUpdateTime: str | None = None, modelingTechnique: str | None = None, updatedBy: str | None = None)

Bases: _ModelV24_2Mixin, pdstools.infinity.resources.prediction_studio.base.AsyncModel

v24.2 Model business logic — defined once.

Parameters:
  • modelId (str)

  • label (str)

  • modelType (str)

  • status (str)

  • componentName (str | None)

  • source (str | None)

  • lastUpdateTime (str | None)

  • modelingTechnique (str | None)

  • updatedBy (str | None)

async get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: bool = False) pdstools.infinity.internal._pagination.AsyncPaginatedList[pdstools.infinity.resources.prediction_studio.base.AsyncNotification] | polars.DataFrame

Fetches a list of notifications for a specific model.

Parameters:
  • category ({"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None, optional) – The category of notifications to retrieve. If not specified, all notifications are fetched.

  • return_df (bool, default False) – If True, returns the notifications as a DataFrame. Otherwise, returns a list.

Returns:

A list of notifications or a DataFrame containing the notifications.

Return type:

AsyncPaginatedList[AsyncNotification] or polars.DataFrame

class Model(client, *, modelId: str, label: str, modelType: str, status: str, componentName: str | None = None, source: str | None = None, lastUpdateTime: str | None = None, modelingTechnique: str | None = None, updatedBy: str | None = None)

Bases: _ModelV24_2Mixin, pdstools.infinity.resources.prediction_studio.base.Model

v24.2 Model business logic — defined once.

Parameters:
  • modelId (str)

  • label (str)

  • modelType (str)

  • status (str)

  • componentName (str | None)

  • source (str | None)

  • lastUpdateTime (str | None)

  • modelingTechnique (str | None)

  • updatedBy (str | None)

get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: Literal[False] = False) pdstools.infinity.internal._pagination.PaginatedList[pdstools.infinity.resources.prediction_studio.base.Notification]
get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: Literal[True] = True) polars.DataFrame

Fetches a list of notifications for a specific model.

This function retrieves notifications related to a model. You can filter these notifications by their category. Optionally, the notifications can be returned as a DataFrame for easier analysis and visualization.

Parameters:
  • category ({"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None, optional) – The category of notifications to retrieve. If not specified, all notifications are fetched.

  • return_df (bool, default False) – If True, returns the notifications as a DataFrame. Otherwise, returns a list.

Returns:

A list of notifications or a DataFrame containing the notifications, depending on the value of return_df.

Return type:

PaginatedList[Notification] or polars.DataFrame

class AsyncPrediction(client, *, predictionId: str, label: str, status: str, lastUpdateTime: str, objective: str | None = None, subject: str | None = None)

Bases: _PredictionV24_2Mixin, pdstools.infinity.resources.prediction_studio.v24_1.prediction.AsyncPrediction

Async variant of the v24.2 Prediction.

Parameters:
  • predictionId (str)

  • label (str)

  • status (str)

  • lastUpdateTime (str)

  • objective (str | None)

  • subject (str | None)

async get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: bool = False) pdstools.infinity.internal._pagination.AsyncPaginatedList[pdstools.infinity.resources.prediction_studio.base.AsyncNotification] | polars.DataFrame

Fetches a list of notifications for a specific prediction.

Parameters:
  • category ({"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None) – The category of notifications to retrieve.

  • return_df (bool, default False) – If True, returns the notifications as a DataFrame.

Returns:

A list of notifications or a DataFrame.

Return type:

AsyncPaginatedList[AsyncNotification] or polars.DataFrame

async get_champion_challengers()

Fetches list of ChampionChallenger objects linked to the prediction.

Returns:

Champion-challenger pairs from a prediction.

Return type:

list of AsyncChampionChallenger

async add_conditional_model(new_model, category: str, context: str | None = None)

Incorporates a new model into a prediction for a specified category and context.

Parameters:
  • new_model (str or AsyncModel) – Identifier of the model to be added.

  • category (str) – The category under which the model will be classified.

  • context (str, optional) – The specific context or scenario.

Returns:

An object detailing the updated configuration.

Return type:

AsyncChampionChallenger

class Prediction(client, *, predictionId: str, label: str, status: str, lastUpdateTime: str, objective: str | None = None, subject: str | None = None)

Bases: _PredictionV24_2Mixin, pdstools.infinity.resources.prediction_studio.v24_1.prediction.Prediction

The Prediction class provide functionality including retrieving notifications, models, adding conditional models, getting champion challengers, metrics, and plotting metrics.

Parameters:
  • predictionId (str)

  • label (str)

  • status (str)

  • lastUpdateTime (str)

  • objective (str | None)

  • subject (str | None)

get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: Literal[False] = False) pdstools.infinity.internal._pagination.PaginatedList[pdstools.infinity.resources.prediction_studio.base.Notification]
get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: Literal[True] = True) polars.DataFrame

Fetches a list of notifications for a specific prediction.

This function retrieves notifications related to a prediction. You can filter these notifications by their category. Optionally, the notifications can be returned as a DataFrame for easier analysis and visualization.

Parameters:
  • category ({"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None) – The category of notifications to retrieve. If not specified, all notifications are fetched.

  • return_df (bool, default False) – If True, returns the notifications as a DataFrame. Otherwise, returns a list.

Returns:

A list of notifications or a DataFrame containing the notifications, depending on the value of return_df.

Return type:

PaginatedList[Notification] or polars.DataFrame

get_champion_challengers()

Fetches list of ChampionChallenger objects linked to the prediction.

This function fetches Champion-challenger pairs from a prediction. In cases where a challenger model is absent, it returns a ChampionChallenger object containing only the champion model.

Returns:

A list of entries, each pairing a primary model with its challenger across various segments of the prediction.

Return type:

list of ChampionChallenger

add_conditional_model(new_model, category: str, context: str | None = None)

Incorporates a new model into a prediction for a specified category and context.

Parameters:
  • new_model (str or Model) – Identifier of the model to be added.

  • category (str) – The category under which the model will be classified.

  • context (str, optional) – The specific context or scenario in which the model will be utilized.

Returns:

An object detailing the updated configuration with the newly added model.

Return type:

ChampionChallenger

class AsyncPredictionStudio(client: pdstools.infinity.internal._base_client.AsyncAPIClient)

Bases: _PredictionStudioV24_2Mixin, pdstools.infinity.resources.prediction_studio.v24_1.AsyncPredictionStudio

v24.2 PredictionStudio business logic — shared parts.

Parameters:

client (pdstools.infinity.internal._base_client.AsyncAPIClient)

version: str = '24.2'
async repository() pdstools.infinity.resources.prediction_studio.v24_2.repository.AsyncRepository

Gets information about the repository from Prediction Studio.

Returns:

A simple object with the repository’s details.

Return type:

AsyncRepository

async list_models(return_df: bool = False) pdstools.infinity.internal._pagination.AsyncPaginatedList[pdstools.infinity.resources.prediction_studio.v24_2.model.AsyncModel] | polars.DataFrame

Fetches a list of all models from Prediction Studio.

Parameters:

return_df (bool, optional) – Set to True to get the results as a DataFrame.

Return type:

AsyncPaginatedList[AsyncModel] or polars.DataFrame

async list_predictions(return_df: bool = False) pdstools.infinity.internal._pagination.AsyncPaginatedList[pdstools.infinity.resources.prediction_studio.v24_2.prediction.AsyncPrediction] | polars.DataFrame

Fetches a list of all predictions from Prediction Studio.

Parameters:

return_df (bool, optional) – Set to True to get the results as a DataFrame.

Return type:

AsyncPaginatedList[AsyncPrediction] or polars.DataFrame

async get_prediction(prediction_id: str | None = None, label: str | None = None, **kwargs) pdstools.infinity.resources.prediction_studio.v24_2.prediction.AsyncPrediction

Finds and returns a specific prediction from Prediction Studio.

Parameters:
  • prediction_id (str, optional) – The unique ID of the prediction.

  • label (str, optional) – The label of the prediction.

Return type:

AsyncPrediction

async get_model(model_id: str | None = None, label: str | None = None, **kwargs) pdstools.infinity.resources.prediction_studio.v24_2.model.AsyncModel

Finds and returns a specific model from Prediction Studio.

Parameters:
  • model_id (str, optional) – The unique ID of the model.

  • label (str, optional) – The label of the model.

Return type:

AsyncModel

async trigger_datamart_export() pdstools.infinity.resources.prediction_studio.v24_2.datamart_export.AsyncDatamartExport

Initiates an export of model data to the Repository.

Returns:

An object with information about the data export process.

Return type:

AsyncDatamartExport

async get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: bool = False) pdstools.infinity.internal._pagination.AsyncPaginatedList[pdstools.infinity.resources.prediction_studio.base.AsyncNotification] | polars.DataFrame

Fetches a list of notifications from Prediction Studio.

Parameters:
  • category ({"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None, optional) – The category of notifications to retrieve.

  • return_df (bool, default False) – If True, returns as a DataFrame.

Return type:

AsyncPaginatedList[AsyncNotification] or polars.DataFrame

class PredictionStudio(client: pdstools.infinity.internal._base_client.SyncAPIClient)

Bases: _PredictionStudioV24_2Mixin, pdstools.infinity.resources.prediction_studio.v24_1.PredictionStudio

v24.2 PredictionStudio business logic — shared parts.

Parameters:

client (pdstools.infinity.internal._base_client.SyncAPIClient)

version: str = '24.2'
repository() pdstools.infinity.resources.prediction_studio.v24_2.repository.Repository

Gets information about the repository from Prediction Studio.

Returns:

A simple object with the repository’s details, ready to use.

Return type:

Repository

list_models(return_df: Literal[False] = False) pdstools.infinity.internal._pagination.PaginatedList[pdstools.infinity.resources.prediction_studio.v24_2.model.Model]
list_models(return_df: Literal[True]) polars.DataFrame

Fetches a list of all models from Prediction Studio.

Parameters:

return_df (bool, optional) – Set to True to get the results as a DataFrame. By default False.

Returns:

Returns a list of models or a DataFrame with model information.

Return type:

PaginatedList[Model] or polars.DataFrame

list_predictions(return_df: Literal[False] = False) pdstools.infinity.internal._pagination.PaginatedList[pdstools.infinity.resources.prediction_studio.v24_2.prediction.Prediction]
list_predictions(return_df: Literal[True]) polars.DataFrame

Fetches a list of all predictions from Prediction Studio.

Parameters:

return_df (bool, optional) – Set to True to get the results as a DataFrame. By default False.

Returns:

Returns a list of predictions or a DataFrame.

Return type:

PaginatedList[Prediction] or polars.DataFrame

get_prediction(prediction_id: str | None = None, label: str | None = None, **kwargs) pdstools.infinity.resources.prediction_studio.v24_2.prediction.Prediction

Finds and returns a specific prediction from Prediction Studio.

Parameters:
  • prediction_id (str, optional) – The unique ID of the prediction.

  • label (str, optional) – The label of the prediction.

  • **kwargs (dict, optional) – Other details to narrow down the search.

Returns:

The prediction that matches your search criteria.

Return type:

Prediction

Raises:

ValueError – If you don’t provide an ID or label.

get_model(model_id: str | None = None, label: str | None = None, **kwargs) pdstools.infinity.resources.prediction_studio.v24_2.model.Model

Finds and returns a specific model from Prediction Studio.

Parameters:
  • model_id (str, optional) – The unique ID of the model.

  • label (str, optional) – The label of the model.

  • **kwargs (dict, optional) – Other details to help find the model.

Returns:

The model that matches your search.

Return type:

Model

Raises:

ValueError – If you don’t provide an ID or label.

trigger_datamart_export() pdstools.infinity.resources.prediction_studio.v24_2.datamart_export.DatamartExport

Initiates an export of model data to the Repository.

Returns:

An object with information about the data export process.

Return type:

DatamartExport

get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: Literal[False] = False) pdstools.infinity.internal._pagination.PaginatedList[pdstools.infinity.resources.prediction_studio.base.Notification]
get_notifications(category: pdstools.infinity.resources.prediction_studio.types.NotificationCategory | None = None, return_df: Literal[True] = True) polars.DataFrame

Fetches a list of notifications from Prediction Studio.

Parameters:
  • category ({"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None, optional) – The category of notifications to retrieve.

  • return_df (bool, default False) – If True, returns the notifications as a DataFrame.

Returns:

A list of notifications or a DataFrame.

Return type:

PaginatedList[Notification] or polars.DataFrame

class AsyncRepository(client, type, repository_name, bucket_name, root_path, datamart_export_location)

Bases: _RepositoryV24_2Mixin, pdstools.infinity.resources.prediction_studio.v24_1.repository.AsyncRepository

v24.2 Repository data — defined once.

class Repository(client, type, repository_name, bucket_name, root_path, datamart_export_location)

Bases: _RepositoryV24_2Mixin, pdstools.infinity.resources.prediction_studio.v24_1.Repository

v24.2 Repository data — defined once.