pdstools.prediction.Prediction

Attributes

Classes

PredictionPlots

Prediction

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)
Parameters:
  • period (str)

  • query (Optional[pdstools.utils.types.QUERY])

  • return_df (bool)

  • metric (str)

  • title (str)

  • facet_row (str)

  • facet_col (str)

  • bar_mode (bool)

performance_trend(period: str = '1d', *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)
Parameters:
  • period (str)

  • query (Optional[pdstools.utils.types.QUERY])

  • return_df (bool)

lift_trend(period: str = '1d', *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)
Parameters:
  • period (str)

  • query (Optional[pdstools.utils.types.QUERY])

  • return_df (bool)

ctr_trend(period: str = '1d', facetting=False, *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)
Parameters:
  • period (str)

  • query (Optional[pdstools.utils.types.QUERY])

  • return_df (bool)

responsecount_trend(period: str = '1d', facetting=False, *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)
Parameters:
  • period (str)

  • query (Optional[pdstools.utils.types.QUERY])

  • return_df (bool)

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)
property is_available: bool
Return type:

bool

property is_valid: bool
Return type:

bool

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