tabensemb.utils.utils.convert_target_to_indicator#

tabensemb.utils.utils.convert_target_to_indicator(y_pred: ndarray, n_classes: int) ndarray[source]#

Convert the class of each sample to class indicator.

Parameters:
y_pred

The class of each sample (not probabilities). It should be a 1d array or a 2d array whose second dimension is 1.

n_classes

The number of classes.

Returns:
np.ndarray

An array of (n_samples, n_classes) where, at each entry, 1 indicates that the sample belongs to this class.