Skip to content
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

Add Cython wrapper for KL divergence #3757

Merged
merged 9 commits into from
May 12, 2021

Conversation

lowener
Copy link
Contributor

@lowener lowener commented Apr 16, 2021

Closes #798.

@github-actions github-actions bot added the Cython / Python Cython or Python issue label Apr 16, 2021
@lowener lowener added 2 - In Progress Currenty a work in progress feature request New feature or request labels Apr 16, 2021
@lowener lowener added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currenty a work in progress labels Apr 19, 2021
@lowener lowener marked this pull request as ready for review April 19, 2021 18:40
@lowener lowener requested a review from a team as a code owner April 19, 2021 18:40
@lowener lowener changed the title [WIP] Add Cython wrapper for KL divergence Add Cython wrapper for KL divergence Apr 19, 2021
@lowener
Copy link
Contributor Author

lowener commented Apr 22, 2021

@viclafargue and @divyegala can you take a look at this PR to review it ?

Copy link
Member

@divyegala divyegala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small suggestions/questions

python/cuml/metrics/kl_divergence.pyx Outdated Show resolved Hide resolved
python/cuml/metrics/kl_divergence.pyx Outdated Show resolved Hide resolved
python/cuml/metrics/kl_divergence.pyx Outdated Show resolved Hide resolved
python/cuml/test/test_metrics.py Outdated Show resolved Hide resolved
@divyegala divyegala added the non-breaking Non-breaking change label Apr 22, 2021
Copy link
Contributor

@viclafargue viclafargue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking good! Not much to add after @divyegala's review. Just one comment.

python/cuml/metrics/kl_divergence.pyx Outdated Show resolved Hide resolved
@dantegd dantegd added 4 - Waiting on Author Waiting for author to respond to review and removed 3 - Ready for Review Ready for review by team labels Apr 23, 2021
@lowener
Copy link
Contributor Author

lowener commented May 1, 2021

CI Failed on cuml.test.explainer.test_explainer_permutation_shap.test_different_parameters[5-SVR-10-50-float32]
Error Message:

 +  where 3.8148835e-05 = abs(-3.8148835e-05)
 +    where -3.8148835e-05 = <function sum at 0x7f32c086b040>(array([ 0.00177689,  0.02638168, -0.00754013,  0.0040741 ,  0.00998535,\n        0.01032944, -0.00098572,  0.00314636, ...-0.01690979, -0.00846939,\n       -0.00288773,  0.00013657, -0.01478043,  0.00106049, -0.01726761],\n      dtype=float32))
 +      where <function sum at 0x7f32c086b040> = np.sum
 +      and   array([ 0.00177689,  0.02638168, -0.00754013,  0.0040741 ,  0.00998535,\n        0.01032944, -0.00098572,  0.00314636, ...-0.01690979, -0.00846939,\n       -0.00288773,  0.00013657, -0.01478043,  0.00106049, -0.01726761],\n      dtype=float32) = <function asnumpy at 0x7f325c452940>(array([ 0.00177689,  0.02638168, -0.00754013,  0.0040741 ,  0.00998535,\n        0.01032944, -0.00098572,  0.00314636, ...-0.01690979, -0.00846939,\n       -0.00288773,  0.00013657, -0.01478043,  0.00106049, -0.01726761],\n      dtype=float32))
 +        where <function asnumpy at 0x7f325c452940> = cp.asnumpy
 +  and   3.0517578125e-05 = abs((-105.86811 - -105.86808013916016))```

@lowener lowener requested a review from divyegala May 10, 2021 16:36
@lowener lowener added 4 - Waiting on Reviewer Waiting for reviewer to review or respond and removed 4 - Waiting on Author Waiting for author to respond to review labels May 10, 2021
Copy link
Member

@divyegala divyegala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-approving. Just one comment

python/cuml/metrics/kl_divergence.pyx Show resolved Hide resolved
@dantegd dantegd added 4 - Waiting on Author Waiting for author to respond to review and removed 4 - Waiting on Reviewer Waiting for reviewer to review or respond labels May 10, 2021
Copy link
Member

@divyegala divyegala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-commenter
Copy link

Codecov Report

Merging #3757 (0eb98c6) into branch-0.20 (46174b7) will decrease coverage by 0.55%.
The diff coverage is 54.01%.

Impacted file tree graph

@@               Coverage Diff               @@
##           branch-0.20    #3757      +/-   ##
===============================================
- Coverage        85.96%   85.40%   -0.56%     
===============================================
  Files              225      227       +2     
  Lines            16986    17313     +327     
===============================================
+ Hits             14602    14787     +185     
- Misses            2384     2526     +142     
Flag Coverage Δ
dask 48.94% <25.40%> (-0.03%) ⬇️
non-dask 77.35% <51.44%> (-0.46%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/cuml/benchmark/nvtx_benchmark.py 0.00% <0.00%> (ø)
python/cuml/common/memory_utils.py 79.26% <ø> (+0.51%) ⬆️
python/cuml/dask/common/utils.py 43.68% <0.00%> (ø)
python/cuml/ensemble/randomforestclassifier.pyx 83.61% <ø> (ø)
python/cuml/linear_model/logistic_regression.pyx 89.21% <ø> (ø)
python/cuml/neighbors/nearest_neighbors.pyx 93.11% <ø> (-0.03%) ⬇️
python/cuml/tsa/auto_arima.pyx 57.48% <0.00%> (-0.53%) ⬇️
python/cuml/common/base.pyx 74.10% <29.41%> (-6.23%) ⬇️
python/cuml/manifold/t_sne.pyx 78.34% <76.31%> (-1.00%) ⬇️
python/cuml/model_selection/_split.py 88.99% <85.00%> (-1.87%) ⬇️
... and 62 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ea479b...0eb98c6. Read the comment docs.

@lowener lowener added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 4 - Waiting on Author Waiting for author to respond to review labels May 12, 2021
Copy link
Member

@dantegd dantegd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codeowner approval

@dantegd
Copy link
Member

dantegd commented May 12, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 25bee3b into rapidsai:branch-0.20 May 12, 2021
@lowener lowener deleted the 020-kl-api branch May 13, 2021 09:40
vimarsh6739 pushed a commit to vimarsh6739/cuml that referenced this pull request Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge Cython / Python Cython or Python issue feature request New feature or request non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Cython wrapper for KL divergence
5 participants