deephyper.ensemble.loss.ZeroOneLoss

deephyper.ensemble.loss.ZeroOneLoss#

class deephyper.ensemble.loss.ZeroOneLoss(predict_proba: bool = False)[source]#

Bases: Loss

Zero-One loss for classification (a.k.a, error rate).

It has value 1 if the prediction is wrong and 0 if it is correct.

Parameters:

predict_proba (bool, optional) – A boolean indicating if y_pred contains predicted categorical probabilities. Defaults to False for label predictions.

Methods

__call__(y_true: ndarray, y_pred: ndarray | Dict[str, ndarray]) ndarray[source]#

Compute the zero-one loss.

Parameters:
  • y_true (np.ndarray) – the true target values. It should be an array of integers 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".

Returns:

the loss value with first dimension n_samples.

Return type:

np.ndarray