pdstools.prediction.Prediction¶
Attributes¶
Classes¶
Monitor Pega Prediction Studio Predictions |
Module Contents¶
- logger¶
- COLORSCALE_TYPES¶
- Figure¶
- class PredictionPlots(prediction)¶
Bases:
pdstools.utils.namespaces.LazyNamespace
- dependencies = ['plotly']¶
- prediction¶
- _prediction_trend(period: str, query: pdstools.utils.types.QUERY | None, return_df: bool, metric: str, title: str, facet_row: str = None, facet_col: str = None, bar_mode: bool = False)¶
- performance_trend(period: str = '1d', *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
- lift_trend(period: str = '1d', *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
- class Prediction(df: polars.LazyFrame)¶
Monitor Pega Prediction Studio Predictions
- Parameters:
df (polars.LazyFrame)
- predictions: polars.LazyFrame¶
- plot: PredictionPlots¶
- prediction_validity_expr¶
- cdh_guidelines¶
- static from_mock_data(days=70)¶
- summary_by_channel(custom_predictions: List[List] | None = None, by_period: str = None) polars.LazyFrame ¶
Summarize prediction per channel
- Parameters:
custom_predictions (Optional[List[CDH_Guidelines.NBAD_Prediction]], optional) – Optional list with custom prediction name to channel mappings. Defaults to None.
by_period (str, optional) – Optional grouping by time period. Format string as in polars.Expr.dt.truncate (https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.dt.truncate.html), for example “1mo”, “1w”, “1d” for calendar month, week day. If provided, creates a new Period column with the truncated date/time. Defaults to None.
- Returns:
Dataframe with prediction summary (validity, numbers in test, control etc.)
- Return type:
pl.LazyFrame
- overall_summary(custom_predictions: List[List] | None = None, by_period: str = None) polars.LazyFrame ¶
Overall prediction summary. Only valid prediction data is included.
- Parameters:
custom_predictions (Optional[List[CDH_Guidelines.NBAD_Prediction]], optional) – Optional list with custom prediction name to channel mappings. Defaults to None.
by_period (str, optional) – Optional grouping by time period. Format string as in polars.Expr.dt.truncate (https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.dt.truncate.html), for example “1mo”, “1w”, “1d” for calendar month, week day. If provided, creates a new Period column with the truncated date/time. Defaults to None.
- Returns:
Summary across all valid predictions as a dataframe
- Return type:
pl.LazyFrame