Evaluates the model by calculating its accuracy.

eval_accuracy(model, test_ds, dev)

Arguments

model

net, nn_module, neural network model we want to evaluate

test_ds

dataset object from torch used for making test predictions and evaluation

dev

device used for calculations (cpu or gpu)

Value

double, accuracy of provided model

Examples

if (FALSE) { dev <- "cpu" # presaved torch model model <- torch_load(system.file("extdata","clf2",package="fairpan")) # presaved output of `preprocess` function processed <- torch_load(system.file("extdata","processed",package="fairpan")) dsl <- dataset_loader(processed$train_x, processed$train_y, processed$test_x, processed$test_y, batch_size = 5, dev = dev) eval_accuracy(model, dsl$test_ds, dev) }