pdstools.adm.Plots ================== .. py:module:: pdstools.adm.Plots Classes ------- .. autoapisummary:: pdstools.adm.Plots.Plots Module Contents --------------- .. py:class:: Plots(datamart: pdstools.adm.ADMDatamart.ADMDatamart) Bases: :py:obj:`pdstools.utils.namespaces.LazyNamespace` .. py:attribute:: dependencies :value: ['plotly'] .. py:attribute:: dependency_group :value: 'adm' .. py:attribute:: datamart .. py:method:: bubble_chart(*, last: bool = True, rounding: int = 5, query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[Union[str, polars.Expr]] = None, return_df: bool = False) The Bubble Chart, as seen in Prediction Studio :param last: Whether to only include the latest snapshot, by default True :type last: bool, optional :param rounding: To how many digits to round the performance number :type rounding: int, optional :param query: The query to apply to the data, by default None :type query: Optional[QUERY], optional :param facet: Column name or Polars expression to facet the plot into subplots, by default None :type facet: Optional[Union[str, pl.Expr]], optional :param return_df: Whether to return a dataframe instead of a plot, by default False :type return_df: bool, optional .. py:method:: over_time(metric: str = 'Performance', by: Union[polars.Expr, str] = 'ModelID', *, every: Union[str, datetime.timedelta] = '1d', cumulative: bool = False, query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[str] = None, return_df: bool = False) Statistics over time :param metric: The metric to plot, by default "Performance" :type metric: str, optional :param by: The column to group by, by default "ModelID" :type by: Union[pl.Expr, str], optional :param every: By what time period to group, by default "1d" :type every: Union[str, timedelta], optional :param cumulative: Whether to take the cumulative value or the absolute one, by default False :type cumulative: bool, optional :param query: The query to apply to the data, by default None :type query: Optional[QUERY], optional :param facet: Whether to facet the plot into subplots, by default None :type facet: Optional[str], optional :param return_df: Whether to return a dataframe instead of a plot, by default False :type return_df: bool, optional .. py:method:: proposition_success_rates(metric: str = 'SuccessRate', by: str = 'Name', *, top_n: int = 0, query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[str] = None, return_df: bool = False) Proposition Success Rates :param metric: The metric to plot, by default "SuccessRate" :type metric: str, optional :param by: By which column to group the, by default "Name" :type by: str, optional :param top_n: Whether to take a top_n on the `by` column, by default 0 :type top_n: int, optional :param query: A query to apply to the data, by default None :type query: Optional[QUERY], optional :param facet: What facetting column to apply to the graph, by default None :type facet: Optional[str], optional :param return_df: Whether to return a DataFrame instead of the graph, by default False :type return_df: bool, optional .. py:method:: score_distribution(model_id: str, *, return_df: bool = False) .. py:method:: multiple_score_distributions(query: Optional[pdstools.utils.types.QUERY] = None, show_all: bool = True) -> List[Figure] Generate the score distribution plot for all models in the query :param query: A query to apply to the data, by default None :type query: Optional[QUERY], optional :param show_all: Whether to 'show' all plots or just get a list of them, by default True :type show_all: bool, optional :returns: A list of Plotly charts, one for each model instance :rtype: List[go.Figure] .. py:method:: predictor_binning(model_id: str, predictor_name: str, return_df: bool = False) .. py:method:: multiple_predictor_binning(model_id: str, query: Optional[pdstools.utils.types.QUERY] = None, show_all=True) -> List[Figure] .. py:method:: predictor_performance(*, metric: str = 'Performance', top_n: Optional[int] = None, active_only: bool = False, query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[str] = 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. :param metric: The metric to plot, by default "Performance" This is more for future-proofing, once FeatureImportant gets more used. :type metric: str, optional :param top_n: The top n predictors to plot, by default None :type top_n: Optional[int], optional :param active_only: Whether to only consider active predictor performance, by default False :type active_only: bool, optional :param query: The query to apply to the data, by default None :type query: Optional[QUERY], optional :param facet: Whether to facet the plot into subplots, by default None :type facet: Optional[str], optional :param return_df: Whether to return a dataframe instead of a plot, by default False :type return_df: bool, optional .. seealso:: :obj:`pdstools.adm.ADMDatamart.apply_predictor_categorization` how to override the out of the box predictor categorization .. py:method:: predictor_category_performance(*, metric: str = 'Performance', active_only: bool = False, query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[Union[polars.Expr, str]] = None, return_df: bool = False) Plot the predictor category performance :param metric: The metric to plot, by default "Performance" :type metric: str, optional :param active_only: Whether to only analyze active predictors, by default False :type active_only: bool, optional :param query: An optional query to apply, by default None :type query: Optional[QUERY], optional :param facet: By which columns to facet the result, by default None :type facet: Optional[Union[pl.Expr, str]], optional :param return_df: An optional flag to get the dataframe instead, by default False :type return_df: bool, optional :returns: A Plotly figure :rtype: px.Figure .. seealso:: :obj:`pdstools.adm.ADMDatamart.apply_predictor_categorization` how to override the out of the box predictor categorization .. py:method:: predictor_contribution(*, by: str = 'Configuration', query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False) Plots the predictor contribution for each configuration :param by: By which column to plot the contribution, by default "Configuration" :type by: str, optional :param query: An optional query to apply to the data, by default None :type query: Optional[QUERY], optional :param return_df: An optional flag to get a Dataframe instead, by default False :type return_df: bool, optional :returns: A plotly figure :rtype: px.Figure .. seealso:: :obj:`pdstools.adm.ADMDatamart.apply_predictor_categorization` how to override the out of the box predictor categorization .. py:method:: predictor_performance_heatmap(*, top_predictors: int = 20, top_groups: Optional[int] = None, by: Union[pdstools.utils.types.QUERY, str] = 'Name', active_only: bool = False, query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False) .. py:method:: response_gain() .. py:method:: models_by_positives(by: str = 'Channel', query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False) .. py:method:: tree_map(metric: Literal['ResponseCount', 'Positives', 'Performance', 'SuccessRate', 'percentage_without_responses'] = 'Performance', *, by: str = 'Name', query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False) .. py:method:: predictor_count(*, by: str = 'Type', facet: str = 'Configuration', query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False) .. py:method:: binning_lift(model_id: str, predictor_name: str, *, query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False) .. py:method:: partitioned_plot(func: Callable, facets: Set, partition_col: str = 'Configuration', show_plots: bool = True, *args, **kwargs) .. py:method:: propensity_distribution(query: Optional[pdstools.utils.types.QUERY] = None, return_df: bool = False)