Fix "Improve TruncatedSVD.transform on sparse csc matrices #16828"#16837
Merged
rth merged 4 commits intoscikit-learn:masterfrom Apr 5, 2020
PandaTinker:iss16828
Merged
Fix "Improve TruncatedSVD.transform on sparse csc matrices #16828"#16837rth merged 4 commits intoscikit-learn:masterfrom PandaTinker:iss16828
rth merged 4 commits intoscikit-learn:masterfrom
PandaTinker:iss16828
Conversation
In addtion, a benchmark file "bench_TSVDtransform_csc.py" for evaluating the performance improvement.
Member
|
@wornbb Thank you for this PR. In you benchmark, the call to Then, it's great that you published your benchmark script. For this small change, however, I think the benchmark script would not be merged. You can post it here in github, maybe under a "details" section. |
Contributor
Author
|
Hi, @lorentzenchr Thank you for your advice. I have removed the benchmark file. The following this script and outcome. Details |
Member
|
Thank you for the benchmark. The benchmark is timing more than just the def benchmark_converted(dim, trials=100):
X = ss.random(dim, dim, format='csr')
tsvd = TruncatedSVD().fit(X)
start_time = time()
for i in range(trials):
tsvd.transform(X)
return time() - start_time
def benchmark_direct(dim, trials=100):
X = ss.random(dim, dim, format='csc')
tsvd = TruncatedSVD().fit(X)
start_time = time()
for i in range(trials):
tsvd.transform(X)
return time() - start_timeOn master:This PRLooks good to me. |
thomasjpfan
approved these changes
Apr 4, 2020
lorentzenchr
approved these changes
Apr 5, 2020
gio8tisu
pushed a commit
to gio8tisu/scikit-learn
that referenced
this pull request
May 15, 2020
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
Fixes #16828
What does this implement/fix? Explain your changes.
This commit allows the use of csc matrix without conversion to csr in TruncatedSVD.transform.
In addition, a benchmark file "bench_TSVDtransform_csc.py" is added for evaluating
the performance improvement.
Any other comments?
Here is a quick preview of the benchmark.
Performance Comparison
Input_Dimensions With_CSR_Conversion Without_Conversion