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 = _DEFAULT.TOP_N.value, top_k: int = _DEFAULT.TOP_K.value, descending: bool = _DEFAULT.DESCENDING.value, missing: bool = _DEFAULT.MISSING.value, remaining: bool = _DEFAULT.REMAINING.value, contribution_calculation: str = _CONTRIBUTION_TYPE.CONTRIBUTION.value) 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. descending (bool): Whether to sort the predictors by most or least contribution. missing (bool): Whether to include missing values in the plot. remaining (bool): predictors/predictor values not included in the top_n/top_k will be grouped into a "remaining" category. contribution_calculation (str): Type of contribution calculation to use. 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 = _DEFAULT.TOP_N.value, top_k: int = _DEFAULT.TOP_K.value, descending: bool = _DEFAULT.DESCENDING.value, missing: bool = _DEFAULT.MISSING.value, remaining: bool = _DEFAULT.REMAINING.value, contribution_calculation: str = _CONTRIBUTION_TYPE.CONTRIBUTION.value) -> tuple[plotly.graph_objects.Figure, List[plotly.graph_objects.Figure]] .. py:method:: plot_contributions_by_context(context: dict[str, str], top_n: int = _DEFAULT.TOP_N.value, top_k: int = _DEFAULT.TOP_K.value, descending: bool = _DEFAULT.DESCENDING.value, missing: bool = _DEFAULT.MISSING.value, remaining: bool = _DEFAULT.REMAINING.value, contribution_calculation: str = _CONTRIBUTION_TYPE.CONTRIBUTION.value) -> tuple[plotly.graph_objects.Figure, plotly.graph_objects.Figure, List[plotly.graph_objects.Figure]] .. py:method:: _plot_overall_contributions(df: polars.DataFrame, x_col: str, y_col: str, x_title: str = X_AXIS_TITLE_DEFAULT, y_title: str = Y_AXIS_TITLE_DEFAULT, context: Optional[pdstools.explanations.ExplanationsUtils.ContextInfo] = None) -> plotly.graph_objects.Figure :staticmethod: .. py:method:: _plot_predictor_contributions(df: polars.DataFrame, x_col: str, y_col: str, x_title: str = X_AXIS_TITLE_DEFAULT, y_title: str = Y_AXIS_TITLE_DEFAULT) -> list[plotly.graph_objects.Figure] :staticmethod: .. py:method:: _plot_context_table(context_info: pdstools.explanations.ExplanationsUtils.ContextInfo) -> plotly.graph_objects.Figure :staticmethod: