Custom neural network not training
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi;
I'm trying to set up a custom neural network, but when I train it, it doesn't train : the training process makes 0 iterations! I don't get any errors though, just 0 iterations, and I have no idea why. (The architecture might seem odd to you, it is supposed to be a custom PNN. But before we can even discuss if it makes sense or not, I would like to be able to train it...)
Here is the code
net = network;
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
net.numInputs = 1;
net.numLayers = (2*nbclasses)+1; % (one pattern layer + one summation layer per class) + competition layer
net.inputConnect(1:nbclasses,:) = 1; % connects the input to all pattern layers
for i = 1:nbclasses % Connect the pattern layers to their corresponding summation layers
net.layerConnect(i+nbclasses,i) = 1;
net.layers{i}.size = size(tr_feature,1);
net.layers{i}.transferFcn = 'radbas';
end
for i = (nbclasses+1):(nbclasses*2) % Connect all summation layers to the competition layer
net.layers{i}.size = 1;
net.layerConnect(net.numLayers,i) = 1;
end
net.layers{net.numLayers}.transferFcn = 'compet';
net.outputConnect(1,end) = 1;
net.view;
[net, tr] = train(net,tr_feature',tr_true');
% tr_feature is a 800x2 data matrix, tr_true is the 800x1 corresponding labels
Any idea?
Thanks in advance!
1 Commento
Greg Heath
il 30 Giu 2013
Modificato: Greg Heath
il 30 Giu 2013
The best way for us to help is to have
1.The name of one of the MATLAB nndata sets (help nndatasets) on which we can test your code. For example, the crab_data set using only the first row of the target matrix.
2. Post code that either runs when cut and pasted or is close to running.Include any error messages.
3. Have you looked at the results of
net = newpnn(tr_feature',ind2vec(tr_true')) % NO SEMICOLON
4. The notation 'tr' should be reserved for the training record output of training, i.e., [ net tr ] = train(net,input,target);
5. nbclasses = 2?
Hope this helps.
Greg
Risposte (0)
Vedere anche
Categorie
Scopri di più su Define Shallow Neural Network Architectures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!