Hello all,
I am applying a multiplayer perceptron with back-propagation and momentum to a classification problem. The data consists of 20 continuous features and 1 binary predictor (class: 0 or 1).
As the title suggests, I am unsure how to specify the number of neurons/layers in my network. I am using the traingdm function.
Using the following code, I have access to the number of neurons (3 here) but not the number of hidden layers:
%%Data
%Load Data
data = csvread('voice.csv');%Seperate features from predictors
X = data(:, 1:end-1)';Y = data(:, end)';%%Model 1
net1 = patternnet(3,'traingdm');net2 = train(net1, X, Y);
Preferably though, I would rather use the traingdm function like this as it gives access to a lot more parameters, however, I seem to lose the ability to specify the number of neurons:
%%Data%Load Datadata = csvread('voice.csv');%Seperate features from predictorsX = data(:, 1:end-1)';Y = data(:, end)';%%Model 2
net.trainFcn = 'traingdm';net.trainParam.epochs = 10000; %Maximum number of epochs to train
net.trainParam.lr = 0.5; %Learning rate
net.trainParam.max_fail = 6; %Validation vectors are used to stop training
%early if the network performance on the validation vectors fails to improve
%or remains the same for max_fail epochs in a row.
net.trainParam.mc = 0.3 % Momentum constant
[net,tr] = train(net, X, Y)
I've read the documentation: http://uk.mathworks.com/help/nnet/ref/traingdm.html but can't seem to find parameters for number of hidden layers or number of neurons in each layer.
I also can't seem to manually define training/validation/testing sets, it has defaults it uses (70/15/15) but I can't access these values and change them. (I can through the GUI using nnstart but then I lose access to the other parameters – eg learning rate).
Lastly, I can't seem to specify my own activation function.
Assuming I can get around these issues, the end goal would be to do a grid-search to find the best set of parameters for this problem.
I've attached the .csv file in case it's of interest/use to anyone.
Thanks in advance,
RĂ©mi
Best Answer