How create training_labels and testing_labels from my data?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Classification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!