How create training_labels and testing_labels from my data?

2 ビュー (過去 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 Center および File ExchangePattern Recognition and Classification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by