Why bad accuracy with neural network?

1.5k views Asked by At

I have a dataset of 43 examples (data points) and 70'000 features, that means my dataset matrix is (43 x 70'000). The labels contains 4 different values (1-4), i.e. there are 4 classes.

Now, I have done classification with a Deep Belief Network / Neural Network but I'm getting only accuracy of around 25% (chance level) with leave-one-out cross-validation. If I'm using kNN, SVM etc. I'm getting >80% accuracy.

I have used the DeepLearnToolbox for Matlab (https://github.com/rasmusbergpalm/DeepLearnToolbox) and just adapted the Deep Belief Network example from the readme of the toolbox. I have tried different number of hidden layers (1-3) and different number of hidden nodes (100, 500,...) as well as different learning rates, momentum etc but accuracy is still very bad. The feature vectors are scaled to the range [0,1] because this is needed by the toolbox.

In detail I have done the following code (only showing one run of cross-validation):

% Indices of training and test set
train = training(c,m);
test = ~train;

% Train DBN
opts = [];
dbn = [];
dbn.sizes = [500 500 500];
opts.numepochs =   50;
opts.batchsize = 1;
opts.momentum  = 0.001;
opts.alpha     =   0.15;
dbn = dbnsetup(dbn, feature_vectors_std(train,:), opts);
dbn = dbntrain(dbn, feature_vectors_std(train,:), opts);

%unfold dbn to nn
nn = dbnunfoldtonn(dbn, 4);
nn.activation_function = 'sigm';
nn.learningRate = 0.15;
nn.momentum = 0.001;

%train nn
opts.numepochs =  50;
opts.batchsize = 1;
train_labels = labels(train);
nClass = length(unique(train_labels));
L = zeros(length(train_labels),nClass);
for i = 1:nClass
L(train_labels == i,i) = 1;
end

nn = nntrain(nn, feature_vectors_std(train,:), L, opts);
class = nnpredict(nn, feature_vectors_std(test,:));

feature_vectors_std is the (43 x 70'000) matrix with values scaled to [0,1].

Can somebody infer why I'm getting such bad accuracy?

2

There are 2 answers

0
Shihe Zhang On

Obviousely your dataset is too small than the complexcity of your network. reference from there

The complexity of a neural network can be expressed through the number of parameters. In the case of deep neural networks, this number can be in the range of millions, tens of millions and in some cases even hundreds of millions. Let’s call this number P. Since you want to be sure of the model’s ability to generalize, a good rule of a thumb for the number of data points is at least P*P.

While the KNN and SVM is simpler,they don't need that much of data. So they can work better.

0
Ibraim Ganiev On

Because you have much more features than examples in the dataset. In other words: you have big number of weights, and you need to estimate all of them, but you can't, because NN with such huge structure cannot generalize well on so small dataset, you need more data to learn such big number of hidden weights (In fact NN may memorize your training set, but cannot infer it's "knowledge" to test set). At the same time 80% accuracy with such simple methods as SVM and kNN indicates that you can describe your data with much simpler rules, because for example SVM will have only 70k weights (Instead of 70kfirst_layer_size + first_layer_sizesecond_layer_size + ... in NN), kNN will not use weights at all.

Complex model is not silver bullet, the more complex model you trying to fit - the more data you need.