pdstools.infinity.resources.prediction_studio.v24_2.prediction ============================================================== .. py:module:: pdstools.infinity.resources.prediction_studio.v24_2.prediction Classes ------- .. autoapisummary:: pdstools.infinity.resources.prediction_studio.v24_2.prediction.Prediction Module Contents --------------- .. py:class:: Prediction(client: pdstools.infinity.client.SyncAPIClient, *, predictionId: str, label: str, status: str, lastUpdateTime: str, objective: Optional[str] = None, subject: Optional[str] = None) Bases: :py:obj:`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. .. py:method:: get_notifications(category: Optional[pdstools.infinity.resources.prediction_studio.types.NotificationCategory] = None, return_df: Literal[False] = False) -> pdstools.infinity.internal._pagination.PaginatedList[pdstools.infinity.resources.prediction_studio.base.Notification] get_notifications(category: Optional[pdstools.infinity.resources.prediction_studio.types.NotificationCategory] = 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. :param category: The category of notifications to retrieve. If not specified, all notifications are fetched. :type category: {"All", "Responses", "Performance", "Model approval", "Output", "Predictors", "Prediction deployment", "Generic"} or None :param return_df: If True, returns the notifications as a DataFrame. Otherwise, returns a list. :type return_df: bool, default False :returns: A list of notifications or a DataFrame containing the notifications, depending on the value of `return_df`. :rtype: PaginatedList[Notification] or polars.DataFrame .. py:method:: _get_models() -> List[Dict[str, str]] Internel 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 `PredictionModel` objects, each representing a model associated with the prediction. :rtype: list of PredictionModel .. py:method:: get_champion_challengers() -> List[pdstools.infinity.resources.prediction_studio.v24_2.champion_challenger.ChampionChallenger] 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. :rtype: list of ChampionChallenger .. py:method:: add_conditional_model(new_model: Union[str, pdstools.infinity.resources.prediction_studio.v24_2.model.Model], category: str, context: Optional[str] = None) -> pdstools.infinity.resources.prediction_studio.v24_2.champion_challenger.ChampionChallenger Incorporates a new model into a prediction for a specified category and context. This function allows for the addition of a new model to a prediction, tailored to a specific business category or use case. It enables the designation of a context for the model's application. :param new_model: Identifier of the model to be added. :type new_model: str :param category: The category under which the model will be classified. :type category: str :param context: The specific context or scenario in which the model will be utilized. :type context: str, optional :returns: An object detailing the updated configuration with the newly added model. :rtype: ChampionChallenger .. py:method:: get_metric(*, metric: pdstools.infinity.internal._constants.METRIC, start_date: Optional[datetime.date] = None, end_date: Optional[datetime.date] = 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). :param metric: The type of metric to retrieve. :type metric: METRIC :param start_date: The start date for the data retrieval. :type start_date: datetime :param end_date: The end date for the data retrieval. If not provided, data is fetched until the current date. :type end_date: datetime, optional :param frequency: The frequency at which to retrieve the data. Defaults to "Daily". :type frequency: {"Daily", "Weekly", "Monthly"}, optional :returns: A DataFrame containing the requested metric data, including values, snapshot times, and data usage. :rtype: pl.DataFrame :raises NoMonitoringInfo: If no monitoring data is available for the given parameters. .. py:method:: package_staged_changes(message: Optional[str] = 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. :param message: Descriptive message about the changes being deployed. Defaults to "Approving the changes" if not specified. :type message: str, optional :returns: Details the result of the deployment process. :rtype: Response .. py:method:: 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: list: A list of changes staged for the prediction, detailing each modification pending deployment.