where ยต is the mean corrected value of an object, C is the pooled covariance matrix of all the groups and p is the classification probability. Two sets of sample were used; Vcut chips (Figure 1)
and Pillows (Figure 2). The criterion used to classify the objects are their Mean of the red and the green values.
Figure 1
Figure 2
Figure 2
The results of the classification is given by Table 1.
For the Training data, 100% classification was obtained as expected. But for the Test data, only 75% classification was obtained.
In conclusion, the LDA is a good method in classification of objects for random sample.
For this activity, I will give myself a grade of 8 because I did not obtain 100% classification for the test datas.
Appendix:
a = fscanfMat("F:\AP 186\act19\data1.txt");
b = fscanfMat("F:\AP 186\act19\data2.txt");
q = fscanfMat("F:\AP 186\act19\data4.txt");
c(1:4,1:2) = a(1:4,1:2);
c(5:8,1:2) = b(1:4,1:2);
mean_g = mean(c,'r');
a1(1:4,1:2) = a(1:4,1:2);
b1(1:4,1:2) = b(1:4,1:2);
mean_a1 = mean(a1,'r');
mean_b1 = mean(b1,'r');
for i = 1:2
mean_cora1(:,i) = a(:,i)-mean_g(i);
mean_corb1(:,i) = b(:,i)-mean_g(i);
end
c1 = (mean_cora1'*mean_cora1)/4;
c2 = (mean_corb1'*mean_corb1)/4;
for i = 1:2
for j = 1:2
C(i,j) = (4/8)*c1(i,j)+(4/8)*c2(i,j);
end
end
f(:,1) = ((((mean_a1)*inv(C))*c' )-(0.5*((mean_a1*inv(C))*mean_a1'))+log(0.5))';
f(:,2) = ((((mean_b1)*inv(C))*c' )-(0.5*((mean_b1*inv(C))*mean_b1'))+log(0.5))';
For the Training data, 100% classification was obtained as expected. But for the Test data, only 75% classification was obtained.
In conclusion, the LDA is a good method in classification of objects for random sample.
For this activity, I will give myself a grade of 8 because I did not obtain 100% classification for the test datas.
Appendix:
a = fscanfMat("F:\AP 186\act19\data1.txt");
b = fscanfMat("F:\AP 186\act19\data2.txt");
q = fscanfMat("F:\AP 186\act19\data4.txt");
c(1:4,1:2) = a(1:4,1:2);
c(5:8,1:2) = b(1:4,1:2);
mean_g = mean(c,'r');
a1(1:4,1:2) = a(1:4,1:2);
b1(1:4,1:2) = b(1:4,1:2);
mean_a1 = mean(a1,'r');
mean_b1 = mean(b1,'r');
for i = 1:2
mean_cora1(:,i) = a(:,i)-mean_g(i);
mean_corb1(:,i) = b(:,i)-mean_g(i);
end
c1 = (mean_cora1'*mean_cora1)/4;
c2 = (mean_corb1'*mean_corb1)/4;
for i = 1:2
for j = 1:2
C(i,j) = (4/8)*c1(i,j)+(4/8)*c2(i,j);
end
end
f(:,1) = ((((mean_a1)*inv(C))*c' )-(0.5*((mean_a1*inv(C))*mean_a1'))+log(0.5))';
f(:,2) = ((((mean_b1)*inv(C))*c' )-(0.5*((mean_b1*inv(C))*mean_b1'))+log(0.5))';
No comments:
Post a Comment