Why does data prediction with cascade forward net not work ?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a problem with making new predictions with my cascade forward net. i created a cascade forward net with 10 Neurons and trained it. Then I tried to make predictions with new data by using sim(net,Xnew) which always gives the same error saying:
Error using network/sim (line 266)
Input data sizes do not match net.inputs{1}.size.
Error in CASCADEnet (line 12)
predCASCADE=sim(netCASCADE,Xnew');
Xnew vector and X vector (with which I trained the net) have the same size. This is my Code so far with X as input and Y as Target vector:
netCASCADE=cascadeforwardnet(10,'trainlm');
netCASCADE.divideParam.trainRatio=0.7;
netCASCADE.divideParam.valRatio=0.15;
netCASCADE.divideParam.testRatio=0.15;
netCASCADE=train(netCASCADE, X',Y');
predCASCADE=sim(netCASCADE,Xnew');
Thanks in advance for help !
댓글 수: 0
답변 (1개)
Nachiket Katakkar
2017년 2월 23일
This error message is observed if the number of columns (input size) in the Test data (Xnew) does not match the number of columns in the Train data (X). I would recommend ensuring that the number of columns in Xnew and X are exactly the same:
>> isequal(size(Xnew,2),size(X,2))
Here is an example with a data-set containing 2 columns and using your code:
load carsmall
X = [Weight,Acceleration];
Y = MPG;
Xnew = X;
netCASCADE=cascadeforwardnet(10,'trainlm');
netCASCADE.divideParam.trainRatio=0.7;
netCASCADE.divideParam.valRatio=0.15;
netCASCADE.divideParam.testRatio=0.15;
netCASCADE=train(netCASCADE, X',Y');
predCASCADE=sim(netCASCADE,Xnew')
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!