tabensemb.utils.utils.convert_proba_to_target#

tabensemb.utils.utils.convert_proba_to_target(y_pred: ndarray, task) ndarray[source]#

Convert probabilities of classes to the class of each sample.

Parameters:
y_pred

An array of predicted probabilities. For binary, it should be the probability of the positive class.

task

“multiclass” or “binary”.

Returns:
np.ndarray

The class of each sample. 2d array (the second dimension is 1) for multiclass tasks. 0-1 array (1d or 2d depending on the input y_pred) for binary tasks.