교차 인증 코드 (matlab code of cross validation)
% 설명: LibSVM 은 이 걸 사용 할 필요 가 없습니다. '- v' 가 실현 되 기 때 문 입 니 다.http://www.cppblog.com/guijie/archive/2013/09/05/169034.html
% 설명: Maingene10FOLD_1. m 있 습 니 다. 용법 이 매우 간단 합 니 다. 크로스 밸 린 드 를 사용 하 는 것 이 좋 습 니 다. 제 프로그램 은 각종 견본 수가 다 를 때 고려 하지 않 았 을 수도 있 습 니 다.구체 적 인 사용 방법: 내 컴퓨터 참조: cite NIPS 2010 \ DLSR \ 코드 \ LSR \ \ TestUministLSRCross Validation. m,
이렇게 쓰 는 게 맞 아. 다 시 는 있 지 마. "
"crossvalind 는 어떻게 사용 합 니까?"
이 위 에 시간 낭비 야.
아래 의 예 는 보지 않 아 도 된다.
crossvalind 프로그램 에서 가 져 온 예% Create a 10 - fold cross - validation to compute classification error. load fisheriris% 이 데 이 터 는 150 개의 견본 indices = crossvalind ('Kfold', species, 10) 가 있 습 니 다.%species 는 견본 의 표지 이 고 indices 는 견본 수 와 같은 벡터 이 며 안의 요 소 는 1 에서 10cp = classperf (species) 이다.Evaluate performance of classifier
for i = 1:10
test = (indices == i);
train = ~test;
class = classify(meas(test,:),meas(train,:),species(train,:));
classperf(cp,class,test)
end
size(test)size(train)
size(meas(test,:),1)
size(meas(train,:),1)
cp.ErrorRate
% 10-fold cross validation
%This code is written by Gui Jie in the afternoon 2009/06/08.%If you have find some bugs in the codes, feel free to contract me
%Reference:
%
% If you used my matlab code, we appreciate it very much if you can cite our following papers:
% Jie Gui et al., "Group sparse multiview patch alignment framework with view consistency for image classification", IEEE Transactions on Image Processing (Accepted)
% Jie Gui et al., "How to estimate the regularization parameter for spectral regression
% discriminant analysis and its kernel version?", IEEE Transactions on Circuits and
% Systems for Video Technology, vol. 24, no. 2, pp. 211-223, 2014
% Jie Gui, Zhenan Sun, Wei Jia, Rongxiang Hu, Yingke Lei and Shuiwang Ji, "Discriminant
% Sparse Neighborhood Preserving Embedding for Face Recognition", Pattern Recognition,
% vol. 45, no.8, pp. 2884–2893, 2012
% Jie Gui, Wei Jia, Ling Zhu, Shuling Wang and Deshuang Huang,
% "Locality Preserving Discriminant Projections for Face and Palmprint Recognition,"
% Neurocomputing, vol. 73, no.13-15, pp. 2696-2707, 2010
% Jie Gui et al., "Semi-supervised learning with local and global consistency",
% International Journal of Computer Mathematics (Accepted)
% Jie Gui, Shu-Lin Wang, and Ying-ke Lei, "Multi-step Dimensionality Reduction and
% Semi-Supervised Graph-Based Tumor Classification Using Gene Expression Data,"
% Artificial Intelligence in Medicine, vol. 50, no.3, pp. 181-191, 2010
% Reference:
%1. Algorithm 2 of "Shuiwang Ji and Jieping Ye. Generalized Linear Discriminant Analysis: A
% Unified Framework and Efficient Model Selection. IEEE Transactions on Neural Networks.
% Vol. 19, No. 10, pp. 1768-1782, 2008."
%2.Foot note 4 of "F.Wang,et al.,marginFace:A novel face recognition method by average neighborhood
% margin maximization,Pattern Recognition (2009)"
v=10;% If v=4,it means 4-fold cross validation.
step=floor(size(fea_train,1)/v);
for j =1:v
if j~= v
startpoint=(j-1)*step+1;
endpoint=(j)*step;
else
startpoint=(j-1)*step+1;
endpoint=size(fea_train,1);
end
cv_p=startpoint:endpoint; %%%% test set position
%%%%%%%%%%%%%% test set
Test_data=fea_train(cv_p,:);
Test_lab=gnd_train(cv_p,:); %%%%label
%%%%%%%%%%%%%% training data
Train_data=fea_train;
Train_data(cv_p,:)='';
Train_lab=gnd_train;
Train_lab(cv_p,:)='';
end
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.