在matlab中使用反向传播的MLP

时间:2016-12-18 23:50:03

标签: matlab

我想构建一个带有7个神经元的隐藏层的MLP网络。我试图在Matlab中使用newff()和train(),但是我收到了这个错误: “函数'subsindex'没有为'network'类的值定义。”

这是我的代码:

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);

任何想法都会有所帮助。 感谢。

1 个答案:

答案 0 :(得分:1)

似乎所有问题都来自:

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'); % I put the transpose command here

它工作了!!!