metric_per_segment_distribution_plot

metric_per_segment_distribution_plot(metrics_df: pandas.core.frame.DataFrame, metric_name: str, per_fold_aggregation_mode: Optional[str] = None, plot_type: Union[Literal['hist'], Literal['box'], Literal['violin']] = 'hist', seaborn_params: Optional[Dict[str, Any]] = None, figsize: Tuple[int, int] = (10, 5))[source]

Plot per-segment metrics distribution.

Parameters
  • metrics_df (pandas.core.frame.DataFrame) – dataframe with metrics calculated on the backtest

  • metric_name (str) – name of the metric to visualize

  • per_fold_aggregation_mode (Optional[str]) –

    • If None, separate distributions for each fold will be drawn

    • If str, determines how to aggregate metrics over the folds if they aren’t already aggregated

    (see PerFoldAggregation)

  • plot_type (Union[Literal['hist'], typing.Literal['box'], typing.Literal['violin']]) – type of plot (see MetricPlotType)

  • seaborn_params (Optional[Dict[str, Any]]) – dictionary with parameters for plotting

  • figsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches

Raises
  • ValueError: – if metric_name isn’t present in metrics_df

  • NotImplementedError: – unknown per_fold_aggregation_mode is given