pdstools.explanations.Plots =========================== .. py:module:: pdstools.explanations.Plots Classes ------- .. autoapisummary:: pdstools.explanations.Plots.Plots Module Contents --------------- .. py:class:: Plots(explanations: pdstools.explanations.Explanations.Explanations) Bases: :py:obj:`pdstools.utils.namespaces.LazyNamespace` .. py:attribute:: dependencies :value: ['numpy', 'plotly'] .. py:attribute:: dependency_group :value: 'explanations' .. py:attribute:: X_AXIS_TITLE_DEFAULT :value: 'Contribution' .. py:attribute:: Y_AXIS_TITLE_DEFAULT :value: 'Predictor' .. py:attribute:: explanations .. py:attribute:: aggregate .. py:method:: contributions(top_n: int = defaults.top_n, top_k: int = defaults.top_k, **filter_kwargs) Plots contributions for the overall model or a selected context. Args: top_n (int): Number of top predictors to display. top_k (int): Number of top unique values for each categorical predictor to display. **filter_kwargs: Optional filtering, sorting, and display controls. Valid keys: - ``sort_by`` (str): Column to rank/select top predictors. Options: ``contribution``, ``contribution_abs``, ``contribution_weighted``, ``contribution_weighted_abs``. Default: ``"contribution_abs"``. - ``display_by`` (str): Column to use for the chart axis values. Default: ``"contribution"``. - ``descending`` (bool): Sort most- or least-impactful first. Default: ``True``. - ``missing`` (bool): Include missing-value bins. Default: ``True``. - ``remaining`` (bool): Include an aggregated "remaining" row. Default: ``True``. - ``include_numeric_single_bin`` (bool): Include numeric predictors that have only a single bin. Default: ``False``. Returns: tuple[go.Figure, list[go.Figure]]: - left: context header if context is selected, otherwise None - right: overall contributions plot and a list of predictor contribution plots. .. py:method:: plot_contributions_for_overall(top_n: int = defaults.top_n, top_k: int = defaults.top_k, **filter_kwargs) -> tuple[plotly.graph_objects.Figure, list[plotly.graph_objects.Figure]] .. py:method:: plot_contributions_by_context(context: dict[str, str], top_n: int = defaults.top_n, top_k: int = defaults.top_k, **filter_kwargs) -> tuple[plotly.graph_objects.Figure, plotly.graph_objects.Figure, list[plotly.graph_objects.Figure]]