fairlearn.experimental package#
Enables experimental functionality that may be migrated to other modules at a later point.
Warning
Anything can break from version to version without further warning.
Utility class for plotting metrics with and without confidence interval ranges.
- 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_frame (fairlearn.metrics.MetricFrame) – The collection of disaggregated metric values, along with the metric errors.
kind (str, 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()
metrics (str or list of str) – The name of the metrics to plot. Should match columns from the given
fairlearn.metrics.MetricFrame
.conf_intervals (str 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]
subplots (bool, default=True) – Whether or not to plot metrics on separate subplots
plot_ci_labels (bool, default=False) – Whether or not to plot numerical labels for the confidence intervals
ci_labels_precision (int, default=4) – The number of digits of precision to show for confidence interval labels
ci_labels_fontsize (int, default=8) – The font size to use for confidence interval labels
ci_labels_color (str, default="black") – The font color to use for confidence interval labels
ci_labels_ha (str, default="center") – The horizontal alignment modifier to use for confidence interval labels
ci_labels_legend (str, default="Conf. Intervals") – The label corresponding to the confidence interval bars
**kwargs – Keyword arguments that are passed in to
pandas.DataFrame.plot()
- Return type
matplotlib.axes.Axes
ornumpy.ndarray
of them