Reputation: 341
I want to build a MLP network with a hidden layer which has 7 neurons. I tried to use newff() and train() in Matlab, but I got this error: "Function 'subsindex' is not defined for values of class 'network'."
here is my code:
mytrain = mytrain';
train_class = train_class';
net = newff(minmax(mytrain),[7 1],{'logsig' 'logsig'}, 'traingd');
net.trainParam.epochs = 100;
net = train(net,mytrain,train_class); % the error comes from here
A = sim(net,mytrain);
Any idea would be helpful. thanks.
Upvotes: 0
Views: 158
Reputation: 341
it seems all problem came from:
mytrain = mytrain';
train_class = train_class';
I removed these two, and write the code like this:
net = newff(minmax(mytrain),[7 1],{'logsig' 'logsig'}, 'traingd');
net.trainParam.epochs = 100;
net = train(net,mytrain',train_class'); % I put the transpose command here
and it worked !!!
Upvotes: 1