I am trying to train this tiny net in Flux:
NN = Chain( Dense(2 => 16, tanh), Dense(16 => 16, tanh), Dense(16 => 1) ) |> f64
I the data comes from a single DataFrame, that I mask, convert the temp to Kelvin and feed this into the DataLoader.
But when I want to train the batches
I get the error:
DimensionMismatch: arrays could not be broadcast to a common size; got a dimension with lengths 3 and 64
That the dimensions do not match. Which I do not unterstand.
train_mask = 1: Int.(length(static_df.T1)//2) x_train = static_df[train_mask, [:Q1, :T1]] x_train.T1 = x_train.T1 .|> celsius2kelvin x_train = x_train|> Matrix x_train = [x for x in eachrow(x_train)] y_train = static_df[train_mask, :T1] .|> celsius2kelvin loader = Flux.DataLoader((data=x_train, label=y_train), batchsize=64, shuffle=false, partial=false) η = 0.001 opt = Flux.setup(Adam(η), NN) epochs = 5 lossₘ(ŷ, y) = sum((ŷ .- y).^2) for i in 1:epochs for mini_batch ∈ loader train!(lossₘ, NN, mini_batch, opt) end end
- How can I correctly load to data and
2.How can I see the progressing loss during the training?