我正在尝试使用 Matthew Rocklin 提出的名为 dask-spark 的项目。
在我的项目中添加dask-spark时,出现了一个问题:等待workers,如下图所示。
在这里,我将两个工作节点(dask)作为 dask-worker tcp://ubuntu8:8786 和 tcp://ubuntu9:8786 运行,并在独立模型上运行两个工作节点(spark),作为 worker-20180918112328-ubuntu8-45764和worker-20180918112413-ubuntu9-41972
我的python代码如下:
from tpot import TPOTClassifier
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
from dask.distributed import Client
import distributed.joblib
from sklearn.externals.joblib import parallel_backend
from dask_spark import spark_to_dask
from pyspark import SparkConf, SparkContext
from dask_spark import dask_to_spark
if __name__ == '__main__':
sc = SparkContext()
#connect to the cluster
client = spark_to_dask(sc)
digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(
digits.data,
digits.target,
train_size=0.75,
test_size=0.25,
)
tpot = TPOTClassifier(
generations=2,
population_size=10,
cv=2,
n_jobs=-1,
random_state=0,
verbosity=0
)
with joblib.parallel_backend('dask.distributed', scheduler_host=' ubuntu8:8786'):
tpot.fit(X_train, y_train)
print(tpot.score(X_test, y_test))
如果您能帮我解决这个问题,我将不胜感激。