pdstools.infinity.resources.prediction_studio.v24_2.prediction._mixin

Classes

_PredictionV24_2Mixin

v24.2 Prediction business logic — shared parts.

Module Contents

class _PredictionV24_2Mixin

v24.2 Prediction business logic — shared parts.

prediction_id: str
async _get_models() list[dict[str, str]]

Internal function to fetch models linked to a specific prediction.

This function gathers all models that are connected to a particular prediction. It organizes these models into three groups: default models, category models, and supporting models, each serving a unique role in making the prediction.

Returns:

A collection of model dicts associated with the prediction.

Return type:

list of dict

async get_metric(*, metric: pdstools.infinity.internal._constants.METRIC, start_date: datetime.date | None = None, end_date: datetime.date | None = None, frequency: Literal['Daily', 'Weekly', 'Monthly'] = 'Daily') polars.DataFrame

Fetches and returns metric data for a prediction within a specified date range, using datetime objects for dates.

This method retrieves metric data, such as performance or usage statistics, for a given prediction. The data can be fetched for a specific period and at a defined frequency (daily, weekly, or monthly).

Parameters:
  • metric (METRIC) – The type of metric to retrieve.

  • start_date (datetime) – The start date for the data retrieval.

  • end_date (datetime, optional) – The end date for the data retrieval. If not provided, data is fetched until the current date.

  • frequency ({"Daily", "Weekly", "Monthly"}, optional) – The frequency at which to retrieve the data. Defaults to “Daily”.

Returns:

A DataFrame containing the requested metric data, including values, snapshot times, and data usage.

Return type:

pl.DataFrame

Raises:

NoMonitoringInfo – If no monitoring data is available for the given parameters.

async package_staged_changes(message: str | None = None)

Initiates the deployment of pending changes for a prediction model into the production setting.

This function initiates a Change Request (CR) to either deploy pending changes directly to a Revision Manager, if available, or to create a branch with all pending changes in Prediction Studio. An optional message can be included to detail the nature of the changes being deployed.

Parameters:

message (str, optional) – Descriptive message about the changes being deployed. Defaults to “Approving the changes” if not specified.

Returns:

Details the result of the deployment process.

Return type:

dict

async get_staged_changes()

Retrieves a list of changes for a specific prediction.

This method is used to fetch the list of changes that have been made to a prediction but not yet deployed to the production environment. The changes are staged and pending deployment.

Returns:

A list of changes staged for the prediction, detailing each modification pending deployment.

Return type:

list