[dask] Add seed to demos. (#10009)
This commit is contained in:
parent
c8f5d190c6
commit
d3f2dbe64f
@ -14,8 +14,9 @@ def main(client):
|
|||||||
# generate some random data for demonstration
|
# generate some random data for demonstration
|
||||||
m = 100000
|
m = 100000
|
||||||
n = 100
|
n = 100
|
||||||
X = da.random.random(size=(m, n), chunks=100)
|
rng = da.random.default_rng(1)
|
||||||
y = da.random.random(size=(m,), chunks=100)
|
X = rng.normal(size=(m, n))
|
||||||
|
y = X.sum(axis=1)
|
||||||
|
|
||||||
# DaskDMatrix acts like normal DMatrix, works as a proxy for local
|
# DaskDMatrix acts like normal DMatrix, works as a proxy for local
|
||||||
# DMatrix scatter around workers.
|
# DMatrix scatter around workers.
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
Example of training with Dask on GPU
|
Example of training with Dask on GPU
|
||||||
====================================
|
====================================
|
||||||
"""
|
"""
|
||||||
|
import cupy as cp
|
||||||
import dask_cudf
|
import dask_cudf
|
||||||
from dask import array as da
|
from dask import array as da
|
||||||
from dask import dataframe as dd
|
from dask import dataframe as dd
|
||||||
@ -72,10 +73,12 @@ if __name__ == "__main__":
|
|||||||
with LocalCUDACluster(n_workers=2, threads_per_worker=4) as cluster:
|
with LocalCUDACluster(n_workers=2, threads_per_worker=4) as cluster:
|
||||||
with Client(cluster) as client:
|
with Client(cluster) as client:
|
||||||
# generate some random data for demonstration
|
# generate some random data for demonstration
|
||||||
|
rng = da.random.default_rng(1)
|
||||||
|
|
||||||
m = 100000
|
m = 100000
|
||||||
n = 100
|
n = 100
|
||||||
X = da.random.random(size=(m, n), chunks=10000)
|
X = rng.normal(size=(m, n))
|
||||||
y = da.random.random(size=(m,), chunks=10000)
|
y = X.sum(axis=1)
|
||||||
|
|
||||||
print("Using DaskQuantileDMatrix")
|
print("Using DaskQuantileDMatrix")
|
||||||
from_ddqdm = using_quantile_device_dmatrix(client, X, y)
|
from_ddqdm = using_quantile_device_dmatrix(client, X, y)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user