braindecode.visualization.plot_confusion_matrix#

braindecode.visualization.plot_confusion_matrix(confusion_mat, class_names=None, figsize=None, colormap=<matplotlib.colors.LinearSegmentedColormap object>, textcolor='black', vmin=None, vmax=None, fontweight='normal', rotate_row_labels=90, rotate_col_labels=0, with_f1_score=False, norm_axes=(0, 1), rotate_precision=False, class_names_fontsize=12)[source]#

Generates a confusion matrix with additional precision and sensitivity metrics as in [1].

Parameters:
  • confusion_mat (2d numpy array) – A confusion matrix, e.g. sklearn confusion matrix: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html

  • class_names (array, optional) – List of classes/targets.

  • figsize (tuple, optional) – Size of the generated confusion matrix figure.

  • colormap (matplotlib cm colormap, optional) –

  • textcolor (str, optional) – Color of the text in the figure.

  • vmin (float, optional) – The data range that the colormap covers.

  • vmax (float, optional) – The data range that the colormap covers.

  • fontweight (str, optional) – Weight of the font in the figure: [ ‘normal’ | ‘bold’ | ‘heavy’ | ‘light’ | ‘ultrabold’ | ‘ultralight’]

  • rotate_row_labels (int, optional) – The rotation angle of the row labels

  • rotate_col_labels (int, optional) – The rotation angle of the column labels

  • with_f1_score (bool, optional) –

  • norm_axes (tuple, optional) –

  • rotate_precision (bool, optional) –

  • class_names_fontsize (int, optional) –

Returns:

fig

Return type:

matplotlib figure

References

[1]

Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J., Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017). Deep learning with convolutional neural networks for EEG decoding and visualization. Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730

Examples using braindecode.visualization.plot_confusion_matrix#

Cropped Decoding on BCIC IV 2a Dataset

Cropped Decoding on BCIC IV 2a Dataset

Basic Brain Decoding on EEG Data

Basic Brain Decoding on EEG Data

Sleep staging on the Sleep Physionet dataset using Chambon2018 network

Sleep staging on the Sleep Physionet dataset using Chambon2018 network

Sleep staging on the Sleep Physionet dataset using Eldele2021

Sleep staging on the Sleep Physionet dataset using Eldele2021

Sleep staging on the Sleep Physionet dataset using U-Sleep network

Sleep staging on the Sleep Physionet dataset using U-Sleep network