hinge_loss

pai4sk.sml_metrics.hinge_loss(data, pred_decision)

Distributed average hinge loss metric. It supports both local and distributed(MPI) implementation.

It supports only binary classification. If the true labels are encoded with +1 and -1, then the hinge loss of a sample is computed as 1 - true_label * predicted_decision. The predicted_decision is the output of the decision_function predict function (the distance of the samples in data to the separating hyperplane). The average hinge loss is the average of (1 - true_label * predicted_decision) across samples. The metric is implemented in a distributed manner for MPI execution.

Parameters
  • data (Supports the following input data-types :) –

    1. Dense matrix (ndarray) of correct labels.

    2. SnapML data partition. This includes the correct labels.

  • pred_decision (Predicted values of the decision function.) – array-like, shape = (n_samples,)

Returns

hinge_loss_value – Returns the average hinge loss of the samples in data.

Return type

float