MultivariateStats.jl icon indicating copy to clipboard operation
MultivariateStats.jl copied to clipboard

LDA Printing flipped in y and x axis data on docs

Open jgardona opened this issue 1 year ago • 0 comments

Hello, good evening.

The LDA comparison with PCA in docs are plotting LDA flipped in Y and X axis. This happens with this example https://juliastats.org/MultivariateStats.jl/stable/lda/

	iris = dataset("datasets", "iris")

	X = Matrix(iris[1:2:end,1:4])'
	X_labels = Vector(iris[1:2:end,5])
	
	pca = fit(PCA, X; maxoutdim=2)
	Ypca = predict(pca, X)

	lda = fit(MulticlassLDA, X, X_labels; outdim=2)
	Ylda = predict(lda, X)
	
	p = plot(layout=(1,2), size=(800,300))
	
	for s in ["setosa", "versicolor", "virginica"]
	
	    points = Ypca[:,X_labels.==s]
	    scatter!(p[1], points[1,:],points[2,:], label=s, legend=:bottomleft)
	    points = Ylda[:,X_labels.==s]
	    scatter!(p[2], points[1,:],points[2,:], label=s, legend=:bottomleft)
	
	end
	plot!(p[1], title="PCA")
	plot!(p[2], title="LDA")

And here are the plots from example

image

And here are the plots in my tests

image

jgardona avatar Feb 20 '24 23:02 jgardona