Borrar filtros
Borrar filtros

Why does data prediction with cascade forward net not work ?

1 visualización (últimos 30 días)
Mara
Mara el 15 de Feb. de 2017
Respondida: Nachiket Katakkar el 23 de Feb. de 2017
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 !

Respuestas (1)

Nachiket Katakkar
Nachiket Katakkar el 23 de Feb. de 2017
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')

Community Treasure Hunt

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

Start Hunting!

Translated by