Feedforward Neural Network with Adapt Training

I have 1*600 cell array for input and target. Each cell array consists of 960*1 samples. So there are 600 elements with 960*1 samples. I have divided columnwise for training.
But now i am facing Memory Issue(array exceeds maximum array size) for Jacobian calculations. I have a situation where i have to train the network for 960*1 (input) to 960*1 (target) only.
i tried to do using for loop[feed 960*1 at a time] -> configure multiple net ->adapt() incremental training-> cal MSE .
i'm facing following error
--Error using + Matrix dimensions must agree.
Error in nn7.grad2 (line 95) gA{i} = gA{i} + LWderivP' * gLWZ{k,i};
This is the error from matlab predefined function. Can you help me in solving this please?

 채택된 답변

Sarah Mohamed
Sarah Mohamed 2018년 1월 4일

0 개 추천

Take a look at the following post for a similar issue that appears to have been caused by the network configuration:
If this doesn't resolve the issue, it would be helpful if you could post the code that generates the error.

댓글 수: 1

Dear Sarah,
That was not helpful as my weights are initialized in feedforwardnet.m.
Please find the code
if true
%Time series problem input x(1) -(trained only to) target t(1), no delays
clear variables
a = load('input.mat');
b = load('output.mat');
x=a.zz;
t=b.z;
x=cell2mat(x); %960*600 double
x=con2seq(x);
t=cell2mat(t);
t=con2seq(t); % i want it sequentially, 1*600 cell array ,960*1 samples
hiddenLayerSize = 335;
trainFcn = 'trainlm';
net= feedforwardnet(hiddenLayerSize,trainFcn);
for i = 1:600
X=x{i}; %%960*1
T=t{i}; %%960*1
[net,Y,E] = adapt(net, X, T); %Return ,network outputs and errors
y = net(X);
%predict = sim(net,X);%%Giving output as y
% Performance
%performance = perform(net, T, E);
%e = gsubtract(T,y);
%MSE code
%plots
%monitor performance and time steps
end

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Greg Heath
Greg Heath 2018년 1월 5일

0 개 추천

Think in terms of column vectors: Each of N I-dimensional "I"nput vectors causes 1 of the N O-dimensional "O"utput vectors. The corresponding data sizes are
[ I N ] = size(Input)
[ O N ] = size(Target) % = size(Output)
Hope this helps.
Thank you for formally accepting my answer
Greg

댓글 수: 1

Pkm
Pkm 2018년 1월 8일
편집: Pkm 2018년 1월 8일
@Greg Yes, in 1*600 cell array with each cell 960*1 matrix for both input and target
Inputs(Each of 600 cell array of 1- dim 960*1 vectors) causes
Targets(Each of 600 cell array of 1 dim 960*1 vectors)
What's wrong ? Although removing feedforward and putting linear layer solved. But i want to use feedforward:(

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

Pkm
2018년 1월 2일

편집:

Pkm
2018년 1월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by