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

[dask] [python] client.rebalance on dask ranker test #3892

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

ffineis
Copy link
Contributor

@ffineis ffineis commented Feb 2, 2021

Further addresses #3817 by making test_dask.py a little bit more predictable. Previously the test_ranker test while using output='array' provided very uneven group allocations among its two test workers, unlike in the case of dask.dataframe input. Because #data is so small (e.g. 100 rows), when one worker gets a small amount of data relative to the other(s), this can cause rather significant discrepancies between the Dask ranker and the standard LGBMRanker. See comment for more background.

Applying client.rebalance in this case (small data and uneven worker data distributions) helps make the tests a bit more predictable, tightening the distribution of observed spearman correlations with LGBMRanker. Thanks for the patience to the maintainers!

@ffineis ffineis requested a review from jameslamb as a code owner February 2, 2021 04:56
@ffineis ffineis changed the title client.rebalance on dask ranker test [dask] [python] client.rebalance on dask ranker test Feb 2, 2021
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

This is awesome! This is one of those fun changes that looks super simple, but I know a ton of good research went into it in #3817 (comment).

Thanks very much 🚀

@@ -409,7 +418,7 @@ def test_ranker(output, client, listen_port, group):
# have high rank correlation with scores from serial ranker.
dcor = spearmanr(rnkvec_dask, y).correlation
assert dcor > 0.6
assert spearmanr(rnkvec_dask, rnkvec_local).correlation > 0.75
assert spearmanr(rnkvec_dask, rnkvec_local).correlation > 0.8
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice! I'm comfortable with this, given the distributed you saw in #3817 (comment)

from distributed.utils_test import client, cluster_fixture, gen_cluster, loop
from scipy.sparse import csr_matrix
from sklearn.datasets import make_blobs, make_regression
from sklearn.utils import check_random_state
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh thanks for removing this. Didn't realize it was unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all credit goes to pycharm

@jameslamb jameslamb merged commit a4cae37 into microsoft:master Feb 2, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants