Skip to content

MulticlassLDA documentation - #202

Merged
wildart merged 4 commits into
JuliaStats:masterfrom
pnavaro:master
Aug 23, 2022
Merged

MulticlassLDA documentation#202
wildart merged 4 commits into
JuliaStats:masterfrom
pnavaro:master

Conversation

@pnavaro

@pnavaro pnavaro commented Aug 19, 2022

Copy link
Copy Markdown
Contributor

The documentation of fit function for MulticlassLDA wasn't displayed.
I think i fixed it. There is no example for LDA so i made a simple one but I am not sure you want it.
I can add it to the PR it you are interested. This is the scikit-learn example though.

using MultivariateStats, RDatasets, Plots

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=(900,300))

for s in ["setosa", "versicolor", "virginica"]

    points = Ypca[:,X_labels.==s]
    scatter!(p[1], points[1,:],points[2,:],marker=:circle,linewidth=0, 
             label=s, legend=:bottomleft)
    points = Ylda[:,X_labels.==s]
    scatter!(p[2], points[1,:],points[2,:],marker=:circle,linewidth=0, 
             label=s, legend=:bottomleft)

end
display(p)

The documentation of `fit` function wasn't displayed on documentation.
Comment thread src/lda.jl Outdated
Comment thread docs/src/lda.md Outdated
@wildart

wildart commented Aug 20, 2022

Copy link
Copy Markdown
Collaborator

And example for LDA would be a nice addition. If you decide to submit PR, please follow the structure of PCA docs.

- Revert the mistake in MulticlassLDA fit function
- Fix the documentation of SubspaceLDA fit function
@pnavaro

pnavaro commented Aug 21, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for your useful comments. I append the example to the LDA page.

@wildart

wildart commented Aug 21, 2022

Copy link
Copy Markdown
Collaborator

You may want to move example in the beginning on the page, just under the LDA description. So it will show up in TOC in the first place.

@pnavaro

pnavaro commented Aug 22, 2022

Copy link
Copy Markdown
Contributor Author

You may want to move example in the beginning on the page, just under the LDA description. So it will show up in TOC in the first place.

Yes it's consistent with the page on principal component analysis.

@wildart
wildart merged commit 462bde7 into JuliaStats:master Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants