使用带有 dask 分布式

问题描述

这是在我的机器上重现错误代码

import numpy as np
import xgboost as xgb
import dask.array as da
import dask.distributed
from dask_cuda import LocalCUDACluster
from dask.distributed import Client

X = da.from_array(np.random.randint(0,10,size=(10,10)))
Y = da.from_array(np.random.randint(0,1)))

cluster = LocalCUDACluster(n_workers=4,threads_per_worker=1)
client = Client(cluster)

dtrain = xgb.dask.daskDeviceQuantileDMatrix(client=client,data=X,label=Y)

params = {'tree_method':'gpu_hist','objective':'rank:pairwise','min_child_weight':1,'max_depth':3,'eta':0.1} 
watchlist = [(trainLong,'train')] 
reg= xgb.dask.train(client,params,dtrain,num_boost_round=10,evals=watchlist,verbose_eval=1)

这里是错误摘要

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-ff1b0329f2f9> in <module>
      1 params = {'tree_method':'gpu_hist','eta':0.1}
      2 watchlist = [(trainLong,'train')]
----> 3 regLong = xgb.dask.train(client,trainLong,verbose_eval=1)

/usr/local/share/anaconda3/lib/python3.7/site-packages/xgboost/data.py in _device_quantile_transform()
    804         return _transform_dlpack(data),feature_names,feature_types
    805     raise TypeError('Value type is not supported for data iterator:' +
--> 806                     str(type(data)))
    807 
    808 

TypeError: Value type is not supported for data iterator:<class 'numpy.ndarray'>

设备分位数矩阵如何仍然作为 numpy 数组传递???

我尝试使用熊猫数据帧并将其转换为 dask 数据帧,然后将其转换为设备分位数矩阵...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)