1

我的输入矩阵为:

input = 
    1     0     0     1     1
    1     0     0     0     1
    1     0     0     0     1
    1     0     0     0     1
    0     0     1     0     0
    0     1     1     1     0
    0     1     1     1     0

T = [eye(10) eye(10) eye(10) eye(10)];

我创建的神经网络是:

net = newff(input,T,[35], {'logsig'})
%net.performFcn = 'sse';
net.divideParam.trainRatio = 1; % training set [%]
net.divideParam.valRatio   = 0; % validation set [%]
net.divideParam.testRatio  = 0; % test set [%]
net.trainParam.goal = 0.001;

到目前为止它工作正常,但是当我使用火车功能时,问题就出现了

[net tr] = train(net,input,T);

matlab 窗口中显示以下错误:

??? Error using ==> network.train at 145
Targets are incorrectly sized for network.
Matrix must have 5 columns.

Error in ==> test at 103
[net tr] = train(net,input,T);

我也尝试过input'and T'。提前感谢任何帮助

4

1 回答 1

1

如果您查看 MATLAB 的官方文档train,您会注意到它T的列数必须与输入矩阵相同,在您的情况下为 5。相反,请尝试:

T = ones(size(input, 1));

或者

T = [1, size(input, 1) - 1];

看看这是否有效。

于 2012-10-25T12:20:15.010 回答