How create training_labels and testing_labels from my data?

조회 수: 1 (최근 30일)
Bajdar Nour
Bajdar Nour 2019년 2월 14일
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개)

카테고리

Help CenterFile Exchange에서 Classification Learner App에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by