フィルターのクリア

"ffnet" neural network crossvalidation

1 回表示 (過去 30 日間)
laplace laplace
laplace laplace 2013 年 6 月 26 日
Indices = crossvalind('Kfold',inputs , 10);
for i=1:10
test = (Indices == i);
train = ~test;
net = newff(inputs(:,train),targets(:,train),20,{},'trainscg');
[net,TR] = traingd(net,inputs,targets);
a = sim(net,inputs(:,train));
b=sim(net,inputs(:,test));
end
this is the code to apply crossvalidation feel free to use it:)
but there is a problem in crossvalind when your input set has a higher dimension than 1
in case your input set consists of row vectors then the crossvalind command should be modified as following:
[M, N] = size (inputs)
indices=crossvalind('Kfold',inputs(1:M,N),10);
*
*so now my question is: in case my input set consists of column vectors how should i modify crossvalind to assign indices NOT to each element of every column vector *BUT to each column vector itself***
: in case someone wants to pass indices to the elements of column vectors of the "inputs matrix" he can do:
C = num2cell(inputs,1);%this will "break" the matrix(inputs) to column vectors
for i=1:length(inputs)
indices=crossvalind('Kfold',C{i},10)
end
  1 件のコメント
Greg Heath
Greg Heath 2013 年 7 月 1 日
I don't have crossvalind. However, I recall a post recommending cvpartition as a superior alternative. That reference also recommended crossval.
Hope this helps.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by