[1c0e03]: / man / focal_loss_multiclass.Rd

Download this file

33 lines (29 with data), 924 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/metrics.R
\name{focal_loss_multiclass}
\alias{focal_loss_multiclass}
\title{Focal loss for two or more labels}
\usage{
focal_loss_multiclass(y_true, y_pred, gamma = 2.5, alpha = c(1))
}
\arguments{
\item{y_true}{Vector of true values.}
\item{y_pred}{Vector of predicted values.}
\item{gamma}{Focusing parameter.}
\item{alpha}{Vector of weighting factors.}
}
\value{
A function implementing focal loss.
}
\description{
Focal loss for two or more labels
}
\examples{
\dontshow{if (reticulate::py_module_available("tensorflow")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
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()
\dontshow{\}) # examplesIf}
}