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