Closed mtiezzi closed 7 years ago
Instead of 360x60x1 use 360x60. See the documentation here: https://github.com/torch/nn/blob/master/doc/criterion.md#nn.ClassNLLCriterion
Sequencer will only take care of the first dimension, as in the time dimension.
Thank you very much, this solved the problem. I'll close the issue. Just one more thing. Have you any idea why the error, obtained with the code
for i = start_i , num_iterations do
_, fs = optim.rprop(feval,x,rprop_params)
if i % opt.print_every == 0 then
print('error for iteration ' .. i .. ' is ' .. fs[1] / rho)
end
after very few iterations get stuck? Maybe the dataset is not very informative?
Start learning
error for iteration 1 is 1.3862942457199
error for iteration 2 is 1.1019926213556
error for iteration 3 is 0.74603102687332
error for iteration 4 is 0.71663362615638
error for iteration 5 is 0.71454483444492
error for iteration 6 is 0.714112207873
error for iteration 7 is 0.71400824098123
error for iteration 8 is 0.71399763805999
error for iteration 9 is 0.71399728076326
error for iteration 10 is 0.71399727662404
error for iteration 11 is 0.71399727662404
error for iteration 12 is 0.71399727662404
error for iteration 13 is 0.71399727662404
error for iteration 14 is 0.71399727662404
error for iteration 15 is 0.71399727662404
error for iteration 16 is 0.71399727662404
error for iteration 17 is 0.71399727662404
error for iteration 18 is 0.71399727662404
error for iteration 19 is 0.71399727662404
error for iteration 20 is 0.71399727662404
error for iteration 21 is 0.71399727662404
error for iteration 22 is 0.71399727662404
error for iteration 23 is 0.71399727662404
error for iteration 24 is 0.71399727662404
I know that the code works because I used it for another dataset with the same dimensions. Previously I used the same network structure, using MSECriterion and optim.
Thanks again
Oh I found out this new dataset was bad formed, all zeroes. So there is no problem. Bye
Hi, I'm using SeqLSTM, my net structure is the following
I was previously using MSECriterion, wrapped by the SequencerCriterion
My learning set has the following size
in the classical form seqlen x batchsize x inputsize
Each of the 4 element in the target is 0 or 1 if an event occur or not. All works perfectly, for each time istant from 1 to 360 the batch are forwarded, backwarded and the learning works.
Now I have to use ClassNllCriterion with the same dataset.
Reading the criterion readme :
So I thought to use the following target set:
where the third dim is a number among 1,2,3,4 depending on the class of the input.
I added a LogSoftMax Layer like found in examples, now the net is:
and I've changed the criterion :
Using the same code that worked with MSECriterion (I'm using optim, so it has to be the same) I got an error in the first forward of the criterion:
It seems that the criterion receivs a target with wrong dimension,but I don't understand why.
Using instead the CrossEntropyCriterion (and so not using the nn.LogSoftMax()) layer ) it works , but the error seems too high (with respect to MSECriterion) and I don't know if it is correct.
Is there something in dimensions I'm doing wrong? Why using CrossEntropyCriterion it works? (I've posted this also in the google group of torch)