Learn R Programming

luz (version 0.5.0)

luz_metric_binary_accuracy: Binary accuracy

Description

Computes the accuracy for binary classification problems where the model returns probabilities. Commonly used when the loss is torch::nn_bce_loss().

Usage

luz_metric_binary_accuracy(threshold = 0.5)

Value

Returns new luz metric.

Arguments

threshold

value used to classifiy observations between 0 and 1.

See Also

Other luz_metrics: luz_metric(), luz_metric_accuracy(), luz_metric_binary_accuracy_with_logits(), luz_metric_binary_auroc(), luz_metric_mae(), luz_metric_mse(), luz_metric_multiclass_auroc(), luz_metric_rmse()

Examples

Run this code
if (torch::torch_is_installed()) {
library(torch)
metric <- luz_metric_binary_accuracy(threshold = 0.5)
metric <- metric$new()
metric$update(torch_rand(100), torch::torch_randint(0, 1, size = 100))
metric$compute()
}

Run the code above in your browser using DataLab