How Quadratic discriminant is separtaing data in projected data space?

1 view (last 30 days)
I have a 4 dimensional data space. I did PCA on the data and tried to separate the data by using FLDA. I understood FLDA projects the data in one dimension and the parameters are adjusted to give a specific choice of projection direction with maximum separation.What I understood from example in matlab FLDA, that the visualization of the separator/discriminator separating two classes do not let us visualize the separation in this FLDA space. I tried projecting the data into one D space and wanted to see the separation. But in case of Quadratic discriminator, there are two discriminator passing in between the clusters and this discriminator is not a conic. I am not sure what I understood is correct and how does these two discriminant classifies my two class problem.
My code does following:
X = Data(:,1:2);
Z = {};
for i = 1:208
Z{i}='flat';
end
for i = 209:416
Z{i} = 'nodules';
end
T = cat(2,Z{:});
T = Z';
cls = ClassificationDiscriminant.fit(X,T,'DiscrimType','quadratic');
hold all;
K = cls.Coeffs(1,2).Const;
L = cls.Coeffs(1,2).Linear;
Q = cls.Coeffs(1,2).Quadratic;
f = @(x1,x2) K + L(1)*x1 + L(2)*x2 + Q(1,1)*x1.^2 + ...
(Q(1,2)+Q(2,1))*x1.*x2 + Q(2,2)*x2.^2;
% Projecting data into FLDA space
y = f(X(:,1),X(:,2));
%Orthogonal projections of data on single dimension
plot(y(:,1:208),'*r')
hold on
plot(y(:,209:416),'*g')
%drawing the quadratic separator
h2 = ezplot(f,[-90 450 -60 20]);
set(h2,'Color','b','LineWidth',2)

Answers (0)

Community Treasure Hunt

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

Start Hunting!