Classification based on textured image
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Need help! IS this the right way to do classification? I cant seem to get the right labels out...
Code:
data = importdata('LDA data2.mat')%LDA data2 is training data with labels
features=data(:,1:end-1); %split data without labels
lable=data(:,end); %get the labels
handles.lable = lable;
ldaClass = classify(features,features,lable);
%-----------------------Cross Validation----------------------------------- split_assignments = cross_val_split(14,size(handles.lableimage,1));
for i=1:1:14
ldaClasses = reshape(ldaClass,359,476);
training_set = ldaClasses(find(split_assignments(:,i)==0),:);
test_set = handles.lableimage(find(split_assignments(:,i)==1),:);
% determine weights from the training set
phi_train=[training_set(:,1).^(0) training_set(:,1).^(1)];
w=pinv(phi_train)*training_set(:,2);
phi_test=[test_set(:,1).^(0) test_set(:,1).^(1)];
% apply learned weights to the test set and compute MSE
MSE(i)=sum((test_set(:,2)-phi_test*w).^2)/size(test_set,1);
end
data2 = importdata('LDA data3.mat') %LDA data3 is data from the picture I want to classify
features2=data2(:,1:end-1);
ldaClass2 = classify(features2,features2,ldaClass);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Classification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!