plot_metric_per_segment¶
- plot_metric_per_segment(metrics_df: pandas.core.frame.DataFrame, metric_name: str, ascending: bool = False, per_fold_aggregation_mode: str = 'mean', top_k: Optional[int] = None, barplot_params: Optional[Dict[str, Any]] = None, figsize: Tuple[int, int] = (10, 5))[source]¶
Plot barplot with per-segment metrics.
- Parameters
metrics_df (pandas.core.frame.DataFrame) – dataframe with metrics calculated on the backtest
metric_name (str) – name of the metric to visualize
ascending (bool) –
If True, small values at the top;
If False, big values at the top.
per_fold_aggregation_mode (str) – how to aggregate metrics over the folds if they aren’t already aggregated (see
PerFoldAggregation
)top_k (Optional[int]) – number segments to show after ordering according to
ascending
barplot_params (Optional[Dict[str, Any]]) – dictionary with parameters for plotting,
seaborn.barplot()
is usedfigsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches
- Raises
ValueError: – if
metric_name
isn’t present inmetrics_df
NotImplementedError: – unknown
per_fold_aggregation_mode
is given