On this page:
model
accuracy
8.12

19 Models and Accuracy🔗ℹ

A model is a function that appoximates the data generating function.

procedure

(model network-fn θ)  (-> tensor? tensor?)

  network-fn : (-> tensor? (-> theta? tensor?))
  θ : theta?
Creates a model from a network function network-fn and a parameter set θ. The model is a function that returns an output tensor? given and input tensor.

procedure

(accuracy a-model xs ys)  number?

  a-model : (-> tensor? tensor?)
  xs : tensor?
  ys : tensor?
Calculates the classification accuracy of the model as a real number between 0.0 and 1.0. ys is a tensor of one-hot tensors. Generates a tensor r by applying model to xs. The shapes of r and ys must be identical. Finally returns the number of positions in (argmax xs) and (argmax (model xs)) that are equal, divided by (tlen ys)