in clearbox/visualization.py [0:0]
def _draw_boxplots(self, named_dfs: list[tuple[str, pd.DataFrame]]):
"""Draw comparison boxplot for each metric from `_metrics` attribute.
Args:
named_dfs: List of `(name, dataframe)` tuples.
- `name` is the string ID associated with the `dataframe` (typically
feature name for a baseline, but it can be the name of other model as
well).
- `dataframe` contains `valid_{metric.name}` float column for each
`metric` from `_metrics` attribute. The data frame of such format is
typically the result of `trainer.get_feature_baseline` call.
"""
f, axes = plt.subplots(
1, len(self._metrics), sharey=True, squeeze=False
)
f.set_figheight(self._boxplot_height)
f.set_figwidth(self._boxplot_width * len(self._metrics))
for i, metric in enumerate(self._metrics):
axes[0, i].set_xlabel(metric.name)
axes[0, i].boxplot(
[df[f"valid_{metric.name}"] for _, df in named_dfs],
patch_artist=True,
vert=False,
medianprops={"color": "white", "linewidth": 1.5},
boxprops={"color": "C0", "facecolor": "C0", "linewidth": 1.5},
whiskerprops={"color": "C0", "linewidth": 1.5},
capprops={"color": "C0", "linewidth": 1.5},
labels=[x for x, _ in named_dfs],
)