-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
FIX Correct LDA
fac
multiplier
#22696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Changed models | |
-------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @Micky774
Co-authored-by: Okon Samuel <39421418+OkonSamuel@users.noreply.github.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
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
'sSVD
solver 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
MASS
implementation forlda
inR
: 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).