top_k_accuracy | R Documentation |
Computes the Top-k accuracy ('targ' is in the top 'k' predictions of 'inp')
top_k_accuracy(inp, targ, k = 5, axis = -1)
inp |
predictions |
targ |
targets |
k |
k |
axis |
axis |
None
## Not run:
loaders = loaders()
data = Data_Loaders(loaders['train'], loaders['valid'])$cuda()
model = nn$Sequential() +
nn$Flatten() +
nn$Linear(28L * 28L, 10L)
metrics = list(accuracy,top_k_accuracy)
learn = Learner(data, model, loss_func = F$cross_entropy, opt_func = Adam,
metrics = metrics)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.