From f484d0bb3b2291c4912fcf5c9a591e50afcd0a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20MZ?= Date: Wed, 31 Mar 2021 21:39:23 -0600 Subject: [PATCH 1/2] increase partitions to 20 in _create_data to avoid having workers without data --- tests/python_package_test/test_dask.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/python_package_test/test_dask.py b/tests/python_package_test/test_dask.py index 1ed7284ce305..a72fc1301ffe 100644 --- a/tests/python_package_test/test_dask.py +++ b/tests/python_package_test/test_dask.py @@ -132,7 +132,7 @@ def _create_ranking_data(n_samples=100, output='array', chunk_size=50, **kwargs) return X, y, w, g_rle, dX, dy, dw, dg -def _create_data(objective, n_samples=1_000, output='array', chunk_size=500, **kwargs): +def _create_data(objective, n_samples=1_000, output='array', chunk_size=50, **kwargs): if objective.endswith('classification'): if objective == 'binary-classification': centers = [[-4, -4], [4, 4]] @@ -198,7 +198,7 @@ def _create_data(objective, n_samples=1_000, output='array', chunk_size=500, **k def _r2_score(dy_true, dy_pred): numerator = ((dy_true - dy_pred) ** 2).sum(axis=0, dtype=np.float64) - denominator = ((dy_true - dy_pred.mean(axis=0)) ** 2).sum(axis=0, dtype=np.float64) + denominator = ((dy_true - dy_true.mean(axis=0)) ** 2).sum(axis=0, dtype=np.float64) return (1 - numerator / denominator).compute() @@ -273,7 +273,7 @@ def test_classifier(output, task, boosting_type, client): p2_proba = local_classifier.predict_proba(X) s2 = local_classifier.score(X, y) - if boosting_type == 'rf' and output == 'dataframe-with-categorical': + if boosting_type == 'rf': # https://github.com/microsoft/LightGBM/issues/4118 assert_eq(s1, s2, atol=0.01) assert_eq(p1_proba, p2_proba, atol=0.8) From 981084f5360b55daae97fe54d0679e0a12fc1703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20MZ?= Date: Fri, 2 Apr 2021 22:45:42 -0600 Subject: [PATCH 2/2] increase top_rate for goss in test_classifier --- tests/python_package_test/test_dask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python_package_test/test_dask.py b/tests/python_package_test/test_dask.py index ad830453b673..a4edc2dd9316 100644 --- a/tests/python_package_test/test_dask.py +++ b/tests/python_package_test/test_dask.py @@ -255,7 +255,7 @@ def test_classifier(output, task, boosting_type, tree_learner, client): 'bagging_fraction': 0.9, }) elif boosting_type == 'goss': - params['top_rate'] = 0.5 + params['top_rate'] = 0.7 dask_classifier = lgb.DaskLGBMClassifier( client=client,