1
$\begingroup$

I'm trying to use Tensorflow for signal classification. The signals are either normal or high-risk signals. For this purpose, I used convolutional neural networks. The length of signals are 685 and the architecture is:

  • Convolution layer with 27 channels and 1 by 16 window size and stride 1.
  • Max pooling layer with 1 by 2 window size and stride 2.
  • Convolution layer with 14 channels and 1 by 32 window size and stride 1.
  • Max pooling layer with 1 by 2 window size and stride 2.
  • Convolution layer with 4 channels and 1 by 32 window size and stride 1.
  • Max pooling layer with 1 by 2 window size and stride 2.
  • Convolution layer with 3 channels and 1 by 10 window size and stride 1.
  • Max pooling layer with 1 by 2 window size and stride 2.
  • Fully connected layer with 20 neurons and dropout layer.
  • Fully connected layer with 10 neurons and dropout layer.
  • And finally Soft max layer.

After training the network using AdamOptimizer with learning rate 0.001 with 150000 signals the training accuracy is near 95 percent (batch training with 16 batch size is used), however testing accuracy using 20000 new signals is almost 50 percent. Since there is just 2 classes, this accuracy is no better than random guess.

model="conv1d-27-16-1,maxpool-2,conv1d-14-32-1,maxpool-2,conv1d-4-32-1,maxpool-2,conv1d-3-10-1,maxpool-2,full-20,full-10,softmax"

cnn=CNN_1D(model,input_size=685,n_classes=2,num_epochs=20,batch_size=16,dropout=0.75)
cnn.read_data('train_input','train_targets','test_input','test_targets')
cnn.build_model()
cnn.training(validation_set='all')

How can I improve the testing accuracy in my network?

$\endgroup$

1 Answer 1

2
$\begingroup$

This is clearly a case of overfitting, since your validation error is way bigger than your training error. Having understood that overfitting is your problem, there are many ways you can address this problem:

I can see that you are already doing dropout, so setting the dropout higher should help. Moreover, you can try using dropout in more layers, not just the two last ones. If setting the dropout rate higher and setting more layers with dropout does not work, then this probably means that your training and validation data do not come from the same distribution. You can study statistical properties of your training data and validation and study if they come from the same distribution.

Extra comment: if there are just two classes, why don't you use a sigmoid activation function in the last layer?

$\endgroup$
6
  • $\begingroup$ Is it better to use sigmoid activation function? $\endgroup$
    – H.H
    Commented Apr 26, 2018 at 4:54
  • $\begingroup$ When there are just two output classes it is the most generally used approach. $\endgroup$ Commented Apr 26, 2018 at 5:33
  • $\begingroup$ I saw this post: stackoverflow.com/a/41409315/6485602 $\endgroup$
    – H.H
    Commented Apr 26, 2018 at 6:33
  • $\begingroup$ I disagree, as with sigmoid you will have just one output layer that gives you a number between 0 and 1, which will be the probability of class 1. The probability of class 0 can be computed as 1 minus the probability of class 1. $\endgroup$ Commented Apr 26, 2018 at 6:51
  • $\begingroup$ What does it mean if I set drop out rate to 1? is it logical? $\endgroup$
    – H.H
    Commented Apr 26, 2018 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.