
Plotting 3 Dimensional Class boundaries of LDA in Matlab
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi guys, I'm doing some classification research and looking into LDA. For now I'm researching Fisher's iris Data that id built into matlab. I understand when it is 2 dimensional the plotting of the boundary lines is quite straight forward. However if I use 3 dimensions I'm not quite sue how to plot the boundary lines. I've used the example on mathworks, for 2-dimensions and this is not a problem (<http://uk.mathworks.com/help/stats/discriminant-analysis.html)>.
I've attached a matlab plot of the 3 features I'm looking to use from the data, what I'm looking to get is a plane across the 3 features that separates the data into its different classes, in this example I'd need 2 planes. This is what is used for 2D
endMdlLinear.ClassNames([2 3])
K = MdlLinear.Coeffs(2,3).Const;
L = MdlLinear.Coeffs(2,3).Linear;
f = @(x1,x2) K + L(1)*x1 + L(2)*x2;
h2 = ezplot(f,[.9 7.1 0 2.5]);
h2.Color = 'r';
h2.LineWidth = 2;
Any help would be appreciated.
0 comentarios
Respuestas (1)
Omanshu Thapliyal
el 28 de Mzo. de 2017
It would be recommended to use fsurf instead of 'ezplot' as it would help you plot a 3d plane, as you require.
Assuming that you have 2 Gaussian random vectors X1 and x2, here's how you could perform LDA and then plots a discriminant plane between the two sets.
X = [X1;X2];
MdlLinear = fitcdiscr(X,c);
K = MdlLinear.Coeffs(1,2).Const;
L = MdlLinear.Coeffs(2,1).Linear;
f = @(x1,x2) K + L(1)*x1 + L(2)*x2;
fsurf(f,'FaceColor',[1 0 0],'EdgeColor','none');
alpha = 0.5;
The script above produces the plot attached:

0 comentarios
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!