Utils

Tsunami provides some utility functions to make your life easier.

Tsunami.accuracyFunction
accuracy(ŷ::AbstractMatrix, y)

Compute the classification accuracy of a batch of predictions against true labels y. y can be either a vector or a matrix. If y is a vector, it is assumed that the labels are integers in the range 1:K where K == size(ŷ, 1) is the number of classes.

source
Tsunami.foreach_trainableFunction
foreach_trainable(f, x, ys...)

Apply f to each trainable array in object x (or x itself if it is a leaf array) recursing into the children given by Optimisers.trainable.

ys are optional additional objects with the same structure as x. f will be applied to corresponding elements of x and ys.

source