pdstools.ih.Plots ================= .. py:module:: pdstools.ih.Plots Attributes ---------- .. autoapisummary:: pdstools.ih.Plots.logger Classes ------- .. autoapisummary:: pdstools.ih.Plots.Plots Module Contents --------------- .. py:data:: logger .. py:class:: Plots(ih: pdstools.ih.IH.IH) Bases: :py:obj:`pdstools.utils.namespaces.LazyNamespace` .. py:attribute:: ih .. py:method:: overall_gauges(condition: Union[str, polars.Expr], *, metric: Optional[str] = 'Engagement', by: Optional[str] = 'Channel', reference_values: Optional[Dict[str, float]] = None, title: Optional[str] = None, query: Optional[pdstools.utils.types.QUERY] = None, return_df: Optional[bool] = False) Creates gauge charts showing overall success rates for different conditions and channels. This method generates a grid of gauge charts that display success rates for combinations of the specified condition and grouping dimension. Each gauge shows the success rate as a percentage, with optional reference values for comparison. :param condition: The condition to group by (e.g., "Experiment", "Issue") :type condition: Union[str, pl.Expr] :param metric: The metric to display success rates for, by default "Engagement" :type metric: Optional[str], optional :param by: The dimension to group by (e.g., "Channel"), by default "Channel" :type by: Optional[str], optional :param reference_values: Dictionary mapping dimension values to reference values for comparison, by default None :type reference_values: Optional[Dict[str, float]], optional :param title: Title for the plot, by default None :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly figure with gauge charts or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame] .. py:method:: response_count_tree_map(*, by: Optional[List[str]] = None, title: Optional[str] = None, query: Optional[pdstools.utils.types.QUERY] = None, return_df: Optional[bool] = False) -> Union[plotly.graph_objects.Figure, polars.LazyFrame] Creates a treemap visualization showing the distribution of response counts. This method generates a hierarchical treemap visualization that displays the count of responses across different dimensions. The treemap allows for exploration of how responses are distributed across various categories and subcategories. :param by: List of dimensions to include in the hierarchy, by default uses common fields if available :type by: Optional[List[str]], optional :param title: Title for the plot, by default None :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly treemap figure or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame] .. py:method:: success_rate_tree_map(*, metric: Optional[str] = 'Engagement', by: Optional[List[str]] = None, title: Optional[str] = None, query: Optional[pdstools.utils.types.QUERY] = None, return_df: Optional[bool] = False) -> Union[plotly.graph_objects.Figure, polars.LazyFrame] Creates a treemap visualization showing success rates across different dimensions. This method generates a hierarchical treemap visualization that displays success rates across different dimensions. The treemap is colored based on the success rate values, allowing for easy identification of high and low performing areas. :param metric: The metric to display success rates for, by default "Engagement" :type metric: Optional[str], optional :param by: List of dimensions to include in the hierarchy, by default uses common fields if available :type by: Optional[List[str]], optional :param title: Title for the plot, by default None :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly treemap figure or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame] .. py:method:: action_distribution(*, by: Optional[str] = 'Name', title: Optional[str] = 'Action Distribution', query: Optional[pdstools.utils.types.QUERY] = None, color: Optional[str] = None, facet: Optional[str] = None, return_df: Optional[bool] = False) -> Union[plotly.graph_objects.Figure, polars.LazyFrame] Creates a bar chart showing the distribution of actions. This method generates a bar chart that displays the count of actions across different categories. The chart can be colored by another dimension and faceted for more detailed analysis. :param by: The dimension to show on the y-axis, by default "Name" :type by: Optional[str], optional :param title: Title for the plot, by default "Action Distribution" :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param color: Dimension to use for coloring the bars, by default None :type color: Optional[str], optional :param facet: Dimension to use for faceting the chart, by default None :type facet: Optional[str], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly bar chart or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame] .. py:method:: success_rate(*, metric: Optional[str] = 'Engagement', every: Union[str, datetime.timedelta] = '1d', title: Optional[str] = None, query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[str] = None, return_df: Optional[bool] = False) -> Union[plotly.graph_objects.Figure, polars.LazyFrame] Creates a line chart showing success rates over time. This method generates a line chart that displays success rates for the specified metric over time. The data can be faceted by another dimension for comparative analysis. :param metric: The metric to display success rates for, by default "Engagement" :type metric: Optional[str], optional :param every: Time interval for aggregation, by default "1d" (daily) :type every: Union[str, timedelta], optional :param title: Title for the plot, by default None :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param facet: Dimension to use for faceting and coloring the chart, by default None :type facet: Optional[str], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly line chart or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame] .. py:method:: response_count(*, every: Union[str, datetime.timedelta] = '1d', title: Optional[str] = 'Responses', query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[str] = None, return_df: Optional[bool] = False) -> Union[plotly.graph_objects.Figure, polars.LazyFrame] Creates a bar chart showing response counts over time. This method generates a bar chart that displays the count of responses over time, colored by outcome type. The chart can be faceted by another dimension for more detailed analysis. :param every: Time interval for aggregation, by default "1d" (daily) :type every: Union[str, timedelta], optional :param title: Title for the plot, by default "Responses" :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param facet: Dimension to use for faceting the chart, by default None :type facet: Optional[str], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly bar chart or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame] .. py:method:: model_performance_trend(*, metric: Optional[str] = 'Engagement', every: Union[str, datetime.timedelta] = '1d', by: Optional[str] = None, title: Optional[str] = 'Model Performance over Time', query: Optional[pdstools.utils.types.QUERY] = None, facet: Optional[str] = None, return_df: Optional[bool] = False) -> Union[plotly.graph_objects.Figure, polars.LazyFrame] Creates a line chart showing model performance (AUC) over time. This method generates a line chart that displays model performance measured by AUC (Area Under the ROC Curve) over time. The performance is calculated based on propensity scores and actual outcomes. The chart can be colored by one dimension and faceted by another for comparative analysis. :param metric: The metric to calculate performance for, by default "Engagement" :type metric: Optional[str], optional :param every: Time interval for aggregation, by default "1d" (daily) :type every: Union[str, timedelta], optional :param by: Dimension to use for coloring the lines, by default None :type by: Optional[str], optional :param title: Title for the plot, by default "Model Performance over Time" :type title: Optional[str], optional :param query: Query to filter the data before aggregation, by default None :type query: Optional[QUERY], optional :param facet: Dimension to use for faceting the chart, by default None :type facet: Optional[str], optional :param return_df: Whether to return the data frame instead of the plot, by default False :type return_df: Optional[bool], optional :returns: A plotly line chart or the underlying data frame if return_df is True :rtype: Union[plotly.graph_objects.Figure, pl.LazyFrame]