Skip to content

Commit

Permalink
[ci] run Dask examples on CI (#4064)
Browse files Browse the repository at this point in the history
* Update Parallel-Learning-Guide.rst

* Update test.sh

* fix path

* address review comments
  • Loading branch information
StrikerRUS authored Mar 15, 2021
1 parent 96728a0 commit b044070
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ import matplotlib\
matplotlib.use\(\"Agg\"\)\
' plot_example.py # prevent interactive window mode
sed -i'.bak' 's/graph.render(view=True)/graph.render(view=False)/' plot_example.py
for f in *.py; do python $f || exit -1; done # run all examples
for f in *.py **/*.py; do python $f || exit -1; done # run all examples
cd $BUILD_DIRECTORY/examples/python-guide/notebooks
conda install -q -y -n $CONDA_ENV ipywidgets notebook
jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb || exit -1 # run all notebooks
Expand Down
6 changes: 5 additions & 1 deletion docs/Parallel-Learning-Guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ Dask

LightGBM's Python package supports distributed learning via `Dask`_. This integration is maintained by LightGBM's maintainers.

.. warning::

Dask integration is only tested on Linux.

Dask Examples
'''''''''''''

For sample code using ``lightgbm.dask``, see `these Dask examples`_ .
For sample code using ``lightgbm.dask``, see `these Dask examples`_.

Training with Dask
''''''''''''''''''
Expand Down
1 change: 0 additions & 1 deletion examples/python-guide/dask/binary-classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lightgbm as lgb

if __name__ == "__main__":

print("loading data")

X, y = make_blobs(n_samples=1000, n_features=50, centers=2)
Expand Down
1 change: 0 additions & 1 deletion examples/python-guide/dask/multiclass-classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lightgbm as lgb

if __name__ == "__main__":

print("loading data")

X, y = make_blobs(n_samples=1000, n_features=50, centers=3)
Expand Down
1 change: 0 additions & 1 deletion examples/python-guide/dask/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lightgbm as lgb

if __name__ == "__main__":

print("loading data")

X, y = make_regression(n_samples=1000, n_features=50)
Expand Down
9 changes: 6 additions & 3 deletions examples/python-guide/dask/ranking.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import dask.array as da
import numpy as np
from distributed import Client, LocalCluster
Expand All @@ -6,11 +8,12 @@
import lightgbm as lgb

if __name__ == "__main__":

print("loading data")

X, y = load_svmlight_file("../lambdarank/rank.train")
group = np.loadtxt("../lambdarank/rank.train.query")
X, y = load_svmlight_file(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'../../lambdarank/rank.train'))
group = np.loadtxt(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'../../lambdarank/rank.train.query'))

print("initializing a Dask cluster")

Expand Down
1 change: 0 additions & 1 deletion examples/python-guide/dask/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lightgbm as lgb

if __name__ == "__main__":

print("loading data")

X, y = make_regression(n_samples=1000, n_features=50)
Expand Down
4 changes: 4 additions & 0 deletions python-package/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ You can use ``python setup.py bdist_wheel`` instead of ``python setup.py install
Install Dask-package
''''''''''''''''''''

.. warning::

Dask-package is only tested on Linux.

To install all additional dependencies required for Dask-package, you can append ``[dask]`` to LightGBM package name:

.. code:: sh
Expand Down

0 comments on commit b044070

Please sign in to comment.