Float32 support factor analysis#13303
Closed
thibsej wants to merge 4 commits intoscikit-learn:mainfrom
Closed
Conversation
thibsej
commented
Feb 27, 2019
| clf_64.fit(X.astype(np.float64)) | ||
|
|
||
| # Check value consistency between types | ||
| rtol = 1e-5 |
Contributor
Author
There was a problem hiding this comment.
The test breaks for rtol=1e-6, even though atol~1e-8 in the test. Should I change the numerical consistency criteria to atol=1e-6 ?
thibsej
commented
Feb 27, 2019
| for method in ['randomized', 'lapack']: | ||
| clf = FactorAnalysis(n_components=n_components, svd_method=method) | ||
| clf.fit(X.astype(data_type)) | ||
| assert clf.components_.dtype == expected_type |
Contributor
Author
There was a problem hiding this comment.
The dtype is tested only for components_, but should any numpy attribute preserve the dtype float32 ? If so, should the test be modified ?
thibsej
commented
Feb 27, 2019
|
|
||
|
|
||
| @pytest.mark.parametrize("method", ['lapack', 'randomized']) | ||
| def test_lda_numeric_consistency_float32_float64(method): |
Contributor
Author
There was a problem hiding this comment.
Considering #13309 I tried running SVD in np.float64 by doing in factor_analysis.py at line216
s, V, unexp_var = my_svd((X / (sqrt_psi * nsqrt)).astype(np.float64))
s, V, unexp_var = s.astype(X.dtype), V.astype(X.dtype), unexp_var.astype(X.dtype)Instead of
s, V, unexp_var = my_svd((X / (sqrt_psi * nsqrt)))But it does not pass the numerical consistency test. There might other sources of numerical stability between types.
2 tasks
28 tasks
This was referenced May 27, 2021
1 task
Member
|
I am closing this PR because it has been superseded by #24321. Thank you for working on this issue! |
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
this PR works on #11000 by preserving the dtype float32 in Factor Analysis.
cross reference: #8769 (comment)
What does this implement/fix? Explain your changes.
Any other comments?