How create training_labels and testing_labels from my data?

2 Ansichten (letzte 30 Tage)
Bajdar Nour
Bajdar Nour am 14 Feb. 2019
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);

Antworten (0)

Kategorien

Mehr zu Pattern Recognition and Classification finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by