I am having trouble defining the crossentropy
loss using Flux.jl.
using Flux,StatsBase
model = Flux.Chain(
Dense(13*16, 128, relu),
Dense(128, 64, relu),
Dense(64, 32, relu),
Dense(32, 4, relu),
softmax);
loss(x,y) = crossentropy(model(x),y)
opt = ADAM(params(model))
I have set up the model to try and predict a 4-label classification problem, but I can’t seem to get the loss
function to work. What form does y
have to be?
For example, my y
for a record can be coded as [0.0,1.0,0.0,0.0]
but running crossentropy
gives Inf (Tracked)
.