Skip to contents

Dictionary of torch loss descriptors. See t_loss() for conveniently retrieving a loss function. Can be converted to a data.table using as.data.table.

Usage

mlr3torch_losses

Available Loss Functions

cross_entropy, l1, mse

Examples

mlr3torch_losses$get("mse")
#> <TorchLoss:mse> Mean Squared Error
#> * Generator: nn_mse_loss
#> * Parameters: list()
#> * Packages: torch,mlr3torch
#> * Task Types: regr,torch
# is equivalent to
t_loss("mse")
#> <TorchLoss:mse> Mean Squared Error
#> * Generator: nn_mse_loss
#> * Parameters: list()
#> * Packages: torch,mlr3torch
#> * Task Types: regr,torch
# convert to a data.table
as.data.table(mlr3torch_losses)
#> Key: <key>
#>              key              label    task_types        packages
#>           <char>             <char>        <list>          <list>
#> 1: cross_entropy      Cross Entropy classif,torch torch,mlr3torch
#> 2:            l1     Absolute Error    regr,torch torch,mlr3torch
#> 3:           mse Mean Squared Error    regr,torch torch,mlr3torch