How create training_labels and testing_labels from my data?
조회 수: 1 (최근 30일)
이전 댓글 표시
My data is M=(150X42)
and labels is Y=(150X1)
when I run the code
Reduced_training_data=1X30, and Reduced_testing_data=1X120, in line 10 and 11
I want to know how to create training_labels and testing_label?? when Y=150X1
1- Folds = 5;
2- PCA_Comp = 42;
3- Features = M;
4- ndices = crossvalind('Kfold',Y,Folds);
5- for i = 1:Folds
6- test = (indices == i); train = ~test;
7- [TRcoeff, TRscore] = pca(Features(train,:));
8- TRreduced=TRcoeff(:,PCA_Comp);
9- % Project the training and testing data onto the reduced components
10- Reduced_training_data=Features(train,:)*TRreduced;
11- Reduced_testing_data=Features(test,:)*TRreduced;
12- % Train and apply the classifier
13- err(ct)=sum(err==Testing_labels);
14- class = classify(Reduced_testing_data,Reduced_training_data,Training_labels);
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!