pdstools.adm.Plots._score

Score-distribution plots for the classifier.

Classes

_ScorePlotsMixin

Common attribute surface used by every plot mixin.

Module Contents

class _ScorePlotsMixin

Bases: pdstools.adm.Plots._base._PlotsBase

Common attribute surface used by every plot mixin.

score_distribution(model_id: str, *, active_range: bool = True, return_df: bool = False)

Generate a score distribution plot for a specific model.

Parameters:
  • model_id (str) – The ID of the model to generate the score distribution for

  • active_range (bool, optional) – Whether to filter to active score range only, by default True

  • return_df (bool, optional) – Whether to return a dataframe instead of a plot, by default False

Returns:

Plotly figure showing score distribution or DataFrame if return_df=True

Return type:

Union[Figure, pl.LazyFrame]

Raises:

ValueError – If no data is available for the provided model ID

Examples

>>> # Score distribution for a specific model (active range only)
>>> fig = dm.plot.score_distribution(model_id="M-1001")
>>> # Include the full score range rather than just the active range
>>> fig = dm.plot.score_distribution(model_id="M-1001", active_range=False)
>>> # Retrieve the underlying binning data
>>> df = dm.plot.score_distribution(model_id="M-1001", return_df=True)
multiple_score_distributions(query: pdstools.utils.types.QUERY | None = None, show_all: bool = True) list[pdstools.utils.plot_utils.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]

Examples

>>> # Generate and display score distributions for all models
>>> figs = dm.plot.multiple_score_distributions()
>>> # Collect figures without displaying them
>>> figs = dm.plot.multiple_score_distributions(show_all=False)
>>> # Limit to a specific channel before generating all distributions
>>> figs = dm.plot.multiple_score_distributions(
...     query={"Channel": "Web"},
...     show_all=False,
... )