Hi . I am new to DNN. I use deep neural network for binary classification but returns all zeros or ones.

I've tried using machine learning approach(SVM, KNN, Tree...) and the accuracy is good.
I am interested in transfer learning so I want to build a deep learning model.
The attached picture is my training data, column 1 to 9 are features and the marked column(10) is the response which will be changed into categorical vector for training.
And here's my code for network training.
And my data for training is attached ༼ •̀ ں •́ ༽ Thanks
layers = [
sequenceInputLayer(9,"Name","sequence")
fullyConnectedLayer(12,"Name","fc_1")
reluLayer("Name","relu_1")
fullyConnectedLayer(96,"Name","fc_3")
reluLayer("Name","relu_2")
fullyConnectedLayer(48,"Name","fc_4")
reluLayer("Name","relu_3")
fullyConnectedLayer(2,"Name","fc_2")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
options = trainingOptions('adam', ...
'InitialLearnRate',0.01, ...
'LearnRateSchedule','piecewise',...
'MaxEpochs',30, ...
'ValidationData',{xtest,ytest}, ...
'ValidationFrequency',3, ...
'MiniBatchSize',1024, ...
'Verbose',1, ...
'Plots','training-progress');

4 Comments

The inputs are cutting and system dynameters of milling, output is 1(stable) and 0(chatter). I want to build a model that gives stability lobe diagram rapidly
Yeah the accuracy is bad since the responses are all the same(ones) for arbitrary predictors.

Sign in to comment.

 Accepted Answer

I recommend normalizing your predictors, they range from 10^-5 to 10^9, pretty insane. I'd rather work with the log10 of that (ranging from -5 to 9).
I would also change the sequence input layer to an imageInputLayer with size [1 9], and possibly adapt the way you give the input data. The sequence input layer is meant for the LSTM model, not your case. The imageInputLayer, although meant for images, works just fine with vectors and matrices of any sort.

3 Comments

Hi Daniel,
I've use log10 to rescale them. But I cannot manage input of imageInputLayer.
Could you please help me with the dimension problems.
Now I have my training data dimensions:
input(4-D double) : size(input)=[9 1 1 N]
output(1xN categorical)
where N is number of samples.
But it returns "Number of observations in X and Y disagree."
Thanks
Oh seems my validation data was wrong dimension and I fixed it.
But the accuracy won't improve as long as reach around 80%, any suggestion for improving results?
it may be because your data is unbalanced, like Srivardhan Gadila said below. When it's too unbalanced, the network will nearly always answer in favor of the most frequent label, effectively "capping" accuracy, and mistaking all the less frequent labels. You should select equal (or nearly equal) ammounts of observations for each label. It should improve your accuracy.

Sign in to comment.

More Answers (1)

Seems that your dataset is unbalanced, count of sequences with label 0 is 59695 and with label 1 is 94226. This could make the learning of the network biased to label 1. Please refer to Prepare and Preprocess Data & Deep Learning Tips and Tricks for more information.
For normalization of data you can make use of the of 'Normalization' & 'NormalizationDimension' Name-Value pair arguments of the sequenceInputLayer or imageInputLayer.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!