필터 지우기
필터 지우기

Classification based on textured image

조회 수: 1 (최근 30일)
Lester Lim
Lester Lim 2013년 1월 29일
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개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by