Cross post from stackoverflow (flux.jl - What is a model in Julia Flux 0.13 and higher? - Stack Overflow)
I want to use Julia Flux for machine learning with custom models (not neural networks, so I won’t be using/combining models provided by Flux). I want to do it with Flux because I want access to various advanced gradient decent algorithms.
To do so I intend to use the training API (Training API · Flux)
The problem is that the documentation is not very detailed. For example there are functions like
Flux.setup(rule, model)
and
Flux.train!(loss, model, data, opt_state)
however nowhere in the API there is a description of what the model
is and what form should it take.
As a test problem, consider matrix factorization. That is, given matrix A
using Random
dim = 2
A = rand(dim, dim)
find such x
and y
that
x * y' ≈ A
I would guess that the model
should be defined as model(x, y) = x * y'
, but then Flux.setup(AdaGrad(), model)
produces a warning
Warning: setup found no trainable parameters in this model