Hello Abdeljalil!



 abdeljalil:

I just tried both SGD and Adam with a learnign rates from 0.000001 to 0.1


It’s probably not the issue, but please also try SGD with no
momentum (momentum = 0.0).


but preferred editing the original post.


Some comments based on your edited post:
First, get rid of the sigmoid() at the end of your model.  Thus:
        output = self.fc3(x)
        return output

And use BCEWithLogitsLoss (rather than BCELoss) as your
criterion.  This is in any event best practice, and it’s possible
that in your case you are getting stuck where sigmoid() saturates
to either 0.0 or 1.0.
(Note, when you convert to BCEWithLogitsLoss, when calculating
your accuracy, you should threshold the output of your model at
0.0 rather than 0.5.  (Rounding a number that is between 0 and
1 is the same as thresholding it at 0.5 in the language I’m using.)
Because your accuracy gets “'stuck” at 50%, I speculate that
your dataset is exactly balanced – that is, it contains the same
number of “healthy” and “faulty” samples – and that your model
(when stuck) always predicts (close to) 0 or (close to) 1.
What do representative predictions from your model look like?
Is your data in fact balanced?  Do you shuffle your data?  Why
do you get exactly (to two decimal digits) 50% accuracy?
(Notice that your accuracy doesn’t move away from 50% until
your loss has fallen from about 14 to about 0.5!)
To clarify, what happens when you run your keras / tensorflow
model multiple times with different random seeds.  Is it robust?
As an aside:  Your output = output.view_as(target)
looks fishy.  I’m guessing that it’s unnecessary (that is, that
your output and target already have the same shape).
What are the shapes of data, output (before view_as()),
and target?
Good luck.
K. Frank