Submitted by International_Deer27 t3_10qhscf in deeplearning
Hi all! I'm currently implementing a CNN in PyTorch and having a hard time with it. It's for a binary classification problem and my loss function keeps fluctuating without a pattern. I've tried many things that I saw online: CrossEntropyLoss function, BCELoss with Sigmoid, BCEWithLogitsLoss, reducing network layers to only a couple, gradient accumulation instead of normal optimization…. My dataset is about 5500 samples with X input of matrix form size 2000x5 and Y 0 or 1. How should I proceed?
like_a_tensor t1_j6q5cs1 wrote
Are you implementing the CNN from scratch? If so, the problem might be in your implementation.
Play with the batch size and batch norm. Try different optimizers. Your learning rate might also be too large; experiment with smaller learning rates or something like torch's ReduceLROnPlateau.
5500 sample is also pretty small, so maybe try a shallower network.