FIX Correct LDA fac multiplier - #22696
Merged
Merged
Conversation
Corrected the 'fac` multiplier in the case of between variance scaling. It really doesn't affect the singular vectors but it should affect the singular values.
added error exception when fitting LinearDiscriminant model with target vector having `n_classes = 1`
thomasjpfan
reviewed
Mar 5, 2022
thomasjpfan
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR!
I'm on the fence about raising an error for n_classes=1. I do not think Linear Discriminant Analysis makes much sense with one class, but fitting on class currently works.
In any case, this PR requires a whats new because it is technically a bug fix. Also this requires an entry in "Changed Models" because in principle someone training on the same data may get a different model:
scikit-learn/doc/whats_new/v1.1.rst
Lines 23 to 24 in 723b707
thomasjpfan
approved these changes
Mar 6, 2022
Co-authored-by: Thomas J. Fan <[email protected]>
glemaitre
pushed a commit
to glemaitre/scikit-learn
that referenced
this pull request
Apr 6, 2022
Co-authored-by: Okon Samuel <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]> Co-authored-by: Jérémie du Boisberranger <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Resolves #15984
What does this implement/fix? Explain your changes.
PR #15984: Identifies inaccuracy in LDA calculation and implements fix.
This PR: Confirms the correctness of the fix, establishes a new test, and continues discussion/review.
Any other comments?
LDA'sSVDsolver implements a solution through this formulation, found inVenables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer:This is backed up by the corresponding
MASSimplementation forldainR: https://github.com/cran/MASS/blob/bf02c4405e66def6178eb8c7c13188f82fd2fd54/R/lda.R#L193I don't really know if this needs a changelog entry, since most results should be unaffected (e.g. current test-suite).