필터 지우기
필터 지우기

Choosing data as training, validation and testing ANN

조회 수: 2 (최근 30일)
Muammar
Muammar 2011년 12월 2일
Hi everyone,
I am a very new in MATLAB and ANN, I want to know how choose the data as training, validation, and testing.
if I have data
A = [1:100] % Input,,,,,,,, B = A.^2 % Target
I want to choose 80% data as training, 10% validation and 10% also as testing.. And how if I want to take it randomly..
If the questions are not very clear, please inform me. Thank you very much
Muammar

채택된 답변

Walter Roberson
Walter Roberson 2011년 12월 2일
The below code would need to be adjusted a bit if A is not a vector.
numA = length(A);
trainsize = floor(0.8 * numA);
valsize = floor(0.8 * numA);
testsize = numA - trainsize - valsize;
ridx = randperm(numA);
traindata = A(ridx(1:trainsize));
valdata = A(ridx(trainsize + 1 : trainsize + valsize));
testdata = A(ridx(end-testsize+1:end));

추가 답변 (2개)

Greg Heath
Greg Heath 2011년 12월 3일
See the input parameter list of the newff documentation
help newff
Hope this helps.
Greg
  댓글 수: 1
Muammar
Muammar 2011년 12월 4일
Hii Greg...
I use newff, but i dont know how to divide the data manually. Example, I want to use A(1:80) as training, A(81:90) as validation and A(91:100) as testing. Thank you..
Muammar

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


Greg Heath
Greg Heath 2011년 12월 6일
It is straightforward:
ptrn = A(1:80);
pval = A(81:90);
ptst = A(91:100);
Similarly for t and B.
Or did I miss something?
Hope this helps.
Greg

카테고리

Help CenterFile Exchange에서 Pattern Recognition and Classification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by