pdstools.adm.Plots¶
Classes¶
Module Contents¶
- class Plots(datamart: pdstools.adm.ADMDatamart.ADMDatamart)¶
Bases:
pdstools.utils.namespaces.LazyNamespace
- Parameters:
datamart (pdstools.adm.ADMDatamart.ADMDatamart)
- dependencies = ['plotly']¶
- dependency_group = 'adm'¶
- datamart¶
- bubble_chart(*, last: bool = True, rounding: int = 5, query: pdstools.utils.types.QUERY | None = None, facet: str | polars.Expr | None = None, return_df: bool = False)¶
The Bubble Chart, as seen in Prediction Studio
- Parameters:
last (bool, optional) – Whether to only include the latest snapshot, by default True
rounding (int, optional) – To how many digits to round the performance number
query (Optional[QUERY], optional) – The query to apply to the data, by default None
facet (Optional[Union[str, pl.Expr]], optional) – Column name or Polars expression to facet the plot into subplots, by default None
return_df (bool, optional) – Whether to return a dataframe instead of a plot, by default False
- over_time(metric: str = 'Performance', by: polars.Expr | str = 'ModelID', *, every: str | datetime.timedelta = '1d', cumulative: bool = False, query: pdstools.utils.types.QUERY | None = None, facet: str | None = None, return_df: bool = False)¶
Statistics over time
- Parameters:
metric (str, optional) – The metric to plot, by default “Performance”
by (Union[pl.Expr, str], optional) – The column to group by, by default “ModelID”
every (Union[str, timedelta], optional) – By what time period to group, by default “1d”
cumulative (bool, optional) – Whether to take the cumulative value or the absolute one, by default False
query (Optional[QUERY], optional) – The query to apply to the data, by default None
facet (Optional[str], optional) – Whether to facet the plot into subplots, by default None
return_df (bool, optional) – Whether to return a dataframe instead of a plot, by default False
- proposition_success_rates(metric: str = 'SuccessRate', by: str = 'Name', *, top_n: int = 0, query: pdstools.utils.types.QUERY | None = None, facet: str | None = None, return_df: bool = False)¶
Proposition Success Rates
- Parameters:
metric (str, optional) – The metric to plot, by default “SuccessRate”
by (str, optional) – By which column to group the, by default “Name”
top_n (int, optional) – Whether to take a top_n on the by column, by default 0
query (Optional[QUERY], optional) – A query to apply to the data, by default None
facet (Optional[str], optional) – What facetting column to apply to the graph, by default None
return_df (bool, optional) – Whether to return a DataFrame instead of the graph, by default False
- multiple_score_distributions(query: pdstools.utils.types.QUERY | None = None, show_all: bool = True) List[Figure] ¶
Generate the score distribution plot for all models in the query
- Parameters:
query (Optional[QUERY], optional) – A query to apply to the data, by default None
show_all (bool, optional) – Whether to ‘show’ all plots or just get a list of them, by default True
- Returns:
A list of Plotly charts, one for each model instance
- Return type:
List[go.Figure]
- multiple_predictor_binning(model_id: str, query: pdstools.utils.types.QUERY | None = None, show_all=True) List[Figure] ¶
- Parameters:
model_id (str)
query (Optional[pdstools.utils.types.QUERY])
- Return type:
List[Figure]
- predictor_performance(*, metric: str = 'Performance', top_n: int | None = None, active_only: bool = False, query: pdstools.utils.types.QUERY | None = None, facet: str | None = None, return_df: bool = False)¶
Plots a bar chart of the performance of the predictors
By default, shows the performance over all models. Use the query argument to drill down to a more specific subset If top n is given, chooses the top predictors based on the weighted average performance across models, sorted by their median performance.
- Parameters:
metric (str, optional) – The metric to plot, by default “Performance” This is more for future-proofing, once FeatureImportant gets more used.
top_n (Optional[int], optional) – The top n predictors to plot, by default None
active_only (bool, optional) – Whether to only consider active predictor performance, by default False
query (Optional[QUERY], optional) – The query to apply to the data, by default None
facet (Optional[str], optional) – Whether to facet the plot into subplots, by default None
return_df (bool, optional) – Whether to return a dataframe instead of a plot, by default False
See also
pdstools.adm.ADMDatamart.apply_predictor_categorization
how to override the out of the box predictor categorization
- predictor_category_performance(*, metric: str = 'Performance', active_only: bool = False, query: pdstools.utils.types.QUERY | None = None, facet: polars.Expr | str | None = None, return_df: bool = False)¶
Plot the predictor category performance
- Parameters:
metric (str, optional) – The metric to plot, by default “Performance”
active_only (bool, optional) – Whether to only analyze active predictors, by default False
query (Optional[QUERY], optional) – An optional query to apply, by default None
facet (Optional[Union[pl.Expr, str]], optional) – By which columns to facet the result, by default None
return_df (bool, optional) – An optional flag to get the dataframe instead, by default False
- Returns:
A Plotly figure
- Return type:
px.Figure
See also
pdstools.adm.ADMDatamart.apply_predictor_categorization
how to override the out of the box predictor categorization
- predictor_contribution(*, by: str = 'Configuration', query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
Plots the predictor contribution for each configuration
- Parameters:
- Returns:
A plotly figure
- Return type:
px.Figure
See also
pdstools.adm.ADMDatamart.apply_predictor_categorization
how to override the out of the box predictor categorization
- predictor_performance_heatmap(*, top_predictors: int = 20, top_groups: int | None = None, by: pdstools.utils.types.QUERY | str = 'Name', active_only: bool = False, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
- response_gain()¶
- models_by_positives(by: str = 'Channel', query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
- tree_map(metric: Literal['ResponseCount', 'Positives', 'Performance', 'SuccessRate', 'percentage_without_responses'] = 'Performance', *, by: str = 'Name', query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
- predictor_count(*, by: str = 'Type', facet: str = 'Configuration', query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶
- binning_lift(model_id: str, predictor_name: str, *, query: pdstools.utils.types.QUERY | None = None, return_df: bool = False)¶