How to implement cross validation with back propogation network

조회 수: 1 (최근 30일)
Subha
Subha 2013년 3월 8일
Sir, How to implement cross validation methods such as k fold and leave one out with back propogation network... i have tried with SVm works good.. but dont know how to merge k fold with bpn... .. thanks
  댓글 수: 1
Subha
Subha 2013년 3월 11일
i've tried this code...
load dataset4_bp_kn_fs
TrainingSet=data;
GroupTrain=target;
Indices = crossvalind('Kfold',GroupTrain , 10);
for i=1:10
test = (Indices == i); train = ~test;
net = newff(TrainingSet(train,:),GroupTrain(train,:),20,{},'trainscg');
[net,TR] = traingd(net,TrainingSet(train,:),TrainingSet(test,:))
a = sim(net,TrainingSet(train,:));
b=sim(net,TrainingSet(test,:));
end
where, data is 16 x 54 and target is 1x54 i'm getting error as, ??? Index exceeds matrix dimensions. and
??? Error using ==> network.subsref at 83 Reference to non-existent field 'lr'.
Error in ==> traingd at 141 lr = net.trainParam.lr; ..
i've made few trials too like setting the target as 3x54 matrix but dono how to proceed with this... really in a confused state..

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

채택된 답변

Tom Lane
Tom Lane 2013년 3월 12일
I am not a nnet expert, but I am under the impression that your inputs should have one column per observation (rather than one row as in the Statistics Toolbox). If that is the case you may need to use "train" and "test" to index into columns rather than rows. Also, I believe traingd wants training set target values as its third input, not X data for the test set.
  댓글 수: 1
Subha
Subha 2013년 3월 12일
Sir with your piece of advice i've done few modification.. like (test,:) as (:,test), now its working good , Accuracy seem to be low, have to try some thing to improve it... but really Matlab is like an ocean.. i've to learn lots more... .. Thank you Sir..

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

추가 답변 (1개)

laplace laplace
laplace laplace 2013년 6월 25일
how did you apply the crossvalind command to column vectors??
  댓글 수: 1
laplace laplace
laplace laplace 2013년 6월 25일
generaly if your data have a dimension how do you apply the crossvalind command?

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by