Visualisations

Visualisations file describes all visualisations tools in PyCalib

pycalib.visualisations.plot_reliability_diagram(labels, scores, legend=None, show_histogram=True, bins=10, class_names=None, fig=None, show_counts=False, errorbar_interval=None, interval_method='beta', fmt='s-', show_correction=False, show_gaps=False, sample_proportion=0, hist_per_class=False, color_list=None, show_bars=False, invert_histogram=False, color_gaps='lightcoral', confidence=False, ax=None)

Plots the reliability diagram of the given scores and true labels

Parameters:
labelsarray (n_samples, )

Labels indicating the true class.

scoresmatrix (n_samples, n_classes) or list of matrices

Output probability scores for one or several methods.

legendlist of strings or None

Text to use for the legend.

show_histogramboolean

If True, it generates an additional figure showing the number of samples in each bin.

binsint or list of floats

Number of bins to create in the scores’ space, or list of bin boundaries.

class_nameslist of strings or None

Name of each class, if None it will assign integer numbers starting with 1.

figmatplotlib.pyplot.Figure or None

Figure to use for the plots, if None a new figure is created.

show_countsboolean

If True shows the number of samples of each bin in its corresponding line marker.

errorbar_intervalfloat or None

If a float between 0 and 1 is passed, it shows an errorbar corresponding to a confidence interval containing the specified percentile of the data.

interval_methodstring (default: ‘beta’)

Method to estimate the confidence interval which uses the function proportion_confint from statsmodels.stats.proportion

fmtstring (default: ‘s-‘)

Format of the lines following the matplotlib.pyplot.plot standard.

show_correctionboolean

If True shows an arrow for each bin indicating the necessary correction to the average scores in order to be perfectly calibrated.

show_gapsboolean

If True shows the gap between the average predictions and the true proportion of positive samples.

sample_proportionfloat in the interval [0, 1] (default 0)

If bigger than 0, it shows the labels of the specified proportion of samples.

hist_per_classboolean

If True shows one histogram of the bins per class.

color_listlist of strings or None

List of string colors indicating the color of each method.

show_barsboolean

If True shows bars instead of lines.

invert_histogramboolean

If True shows the histogram with the zero on top and highest number of bin samples at the bottom.

color_gapsstring

Color of the gaps (if shown).

confidenceboolean

If True shows only the confidence reliability diagram.

Returns:
figmatplotlib.pyplot.figure

Figure with the reliability diagram