fairlearn.metrics._plotter.plot_metric_frame#
- fairlearn.metrics._plotter.plot_metric_frame(metric_frame, *, kind='point', metrics=None, conf_intervals=None, subplots=True, plot_ci_labels=False, ci_labels_precision=4, ci_labels_fontsize=8, ci_labels_color='black', ci_labels_ha='center', ci_labels_legend='Conf. Intervals', **kwargs)[source]#
Visualization for metrics with and without confidence intervals.
Plots a given metric and its given error (as described by conf_intervals)
This function takes in a
fairlearn.metrics.MetricFrame
with precomputed metrics and metric errors and a conf_intervals array to interpret the columns of thefairlearn.metrics.MetricFrame
.The items at each index of the given metrics array and given errors or conf_intervals array should correspond to a pair of the same metric and metric error, respectively.
- Parameters:
- metric_framefairlearn.metrics.MetricFrame
The collection of disaggregated metric values, along with the metric errors.
- kindstr, default=”point”
The type of plot to display, e.g., “point”, “bar”, “line”, etc. The supported values are “point” and those listed in
pandas.DataFrame.plot()
- metricsstr or list of str
The name of the metrics to plot. Should match columns from the given
fairlearn.metrics.MetricFrame
.- conf_intervalsstr or list of str
The name of the confidence intervals to plot. Should match columns from the given
fairlearn.metrics.MetricFrame
.- Note:
The return of the error function should be an array of the lower and upper bounds. e.g.
[0.59, 0.62]
- subplotsbool, default=True
Whether or not to plot metrics on separate subplots
- plot_ci_labelsbool, default=False
Whether or not to plot numerical labels for the confidence intervals
- ci_labels_precisionint, default=4
The number of digits of precision to show for confidence interval labels
- ci_labels_fontsizeint, default=8
The font size to use for confidence interval labels
- ci_labels_colorstr, default=”black”
The font color to use for confidence interval labels
- ci_labels_hastr, default=”center”
The horizontal alignment modifier to use for confidence interval labels
- ci_labels_legendstr, default=”Conf. Intervals”
The label corresponding to the confidence interval bars
- **kwargs
Keyword arguments that are passed in to
pandas.DataFrame.plot()
- Returns:
matplotlib.axes.Axes
ornumpy.ndarray
of them