LDA Printing flipped in y and x axis data on docs

Open
#225 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia

Research direction

Start with the LDA comparison example at the linked stable/lda/ documentation page and run the supplied Julia snippet to reproduce the axis discrepancy. Trace how the MulticlassLDA and PCA predictions are plotted, then inspect the documentation example’s source to determine whether the correction belongs in the docs or in the plotted data orientation. Done means the documented example and generated plots agree on axis orientation.

Written by the indexing model from the issue text.

Description

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

Dominant language
Julia
Stars
387
Forks
83
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaStats/MultivariateStats.jl

All issues in JuliaStats/MultivariateStats.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.