deephyper.ensemble.loss.CategoricalCrossEntropy#
- class deephyper.ensemble.loss.CategoricalCrossEntropy[source]#
Bases:
Loss
Categorical-Cross Entropy (a.k.a., Log-Loss) function for classification.
Methods
- __call__(y_true: ndarray, y_pred: ndarray | Dict[str, ndarray]) ndarray [source]#
Compute the categorical crossentropy loss.
- Parameters:
y_true (np.ndarray) – the true target values. It should be an array of labels or one-hot encoded labels representing the true class labels.
y_pred (np.ndarray or Dict[str, np.ndarray]) – the predicted target values. If it is a _Dict[str, np.ndarray]_ then it should contain a key
"loc"
. It is an array of predicted categorical probabilities.
- Returns:
the loss value with first dimension
n_samples
.- Return type:
np.ndarray