From cf324d21fe9c16f2275c48f94655fe27a76d7f61 Mon Sep 17 00:00:00 2001 From: StrikerRUS Date: Fri, 12 Mar 2021 04:33:41 +0300 Subject: [PATCH] fix path --- examples/python-guide/dask/binary-classification.py | 5 +++++ .../python-guide/dask/multiclass-classification.py | 5 +++++ examples/python-guide/dask/prediction.py | 5 +++++ examples/python-guide/dask/ranking.py | 12 ++++++++++-- examples/python-guide/dask/regression.py | 5 +++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/examples/python-guide/dask/binary-classification.py b/examples/python-guide/dask/binary-classification.py index 4313e8da3ddb..d86fe3536df5 100644 --- a/examples/python-guide/dask/binary-classification.py +++ b/examples/python-guide/dask/binary-classification.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_blobs @@ -5,6 +7,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") diff --git a/examples/python-guide/dask/multiclass-classification.py b/examples/python-guide/dask/multiclass-classification.py index 8e40b35a8121..f17de98f2a84 100644 --- a/examples/python-guide/dask/multiclass-classification.py +++ b/examples/python-guide/dask/multiclass-classification.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_blobs @@ -5,6 +7,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") diff --git a/examples/python-guide/dask/prediction.py b/examples/python-guide/dask/prediction.py index 64e2bae0c08d..19c6ad75b51f 100644 --- a/examples/python-guide/dask/prediction.py +++ b/examples/python-guide/dask/prediction.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_regression @@ -6,6 +8,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data") diff --git a/examples/python-guide/dask/ranking.py b/examples/python-guide/dask/ranking.py index b7cae20a44c4..67b1080d2515 100644 --- a/examples/python-guide/dask/ranking.py +++ b/examples/python-guide/dask/ranking.py @@ -1,3 +1,6 @@ +import os +import sys + import dask.array as da import numpy as np from distributed import Client, LocalCluster @@ -6,11 +9,16 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) 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") diff --git a/examples/python-guide/dask/regression.py b/examples/python-guide/dask/regression.py index 69a8f764732d..5c2766a3d947 100644 --- a/examples/python-guide/dask/regression.py +++ b/examples/python-guide/dask/regression.py @@ -1,3 +1,5 @@ +import sys + import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_regression @@ -5,6 +7,9 @@ import lightgbm as lgb if __name__ == "__main__": + if not sys.platform.startswith('linux'): + print('lightgbm.dask is currently supported in Linux environments') + sys.exit(0) print("loading data")