app.tutorial_metrics module

File: app/tutorial_metrics.py Project: 22HLT01 QUMPHY Contact: nando.hegemann@ptb.de Gitlab: https://gitlab.com/qumphy Description: Tutorial for evaluation metrics for model performance.

app.tutorial_metrics.mc2ml(arr, noise=0.0)[source]

Helper function to convert multi-class array to multi-lable array.

Converts a 1D array with n classes in a matrix with n columns. Each row is zero except for the column corresponding to the class lable, which is set to one. Noise add a perturbation to the values and subsequently normalizes the rows to mimic softmax values.

Return type:

ndarray

Parameters:
  • arr (np.ndarray) – Array with two or more different values.

  • noise (float, optional) – Noise level.

Returns:

Multi-lable version of the array.

Return type:

np.ndarray