focal_loss_multiclass | R Documentation |
Focal loss for two or more labels
focal_loss_multiclass(y_true, y_pred, gamma = 2.5, alpha = c(1))
y_true |
Vector of true values. |
y_pred |
Vector of predicted values. |
gamma |
Focusing parameter. |
alpha |
Vector of weighting factors. |
A function implementing focal loss.
y_true <- matrix(c(0, 1, 0, 0, 0, 1), nrow = 2, byrow = TRUE)
y_pred <- matrix(c(0.15, 0.8, 0.05,
0.08, 0.02, 0.9), nrow = 2, byrow = TRUE)
fl <- focal_loss_multiclass(y_true, y_pred)
fl$numpy()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.