Python spark_sklearn GridSearchCV__init__u;失败,参数错误

Python spark_sklearn GridSearchCV__init__u;失败,参数错误,python,apache-spark,machine-learning,scikit-learn,Python,Apache Spark,Machine Learning,Scikit Learn,我试图使用spark_sklearn.GridSearchCV,但得到init参数错误 TypeError: __init__() takes at least 4 arguments (4 given) 代码如下: from spark_sklearn import GridSearchCV gsearch2 = GridSearchCV(estimator=ensemble.GradientBoostingRegressor(**params), param_grid=param_tes

我试图使用spark_sklearn.GridSearchCV,但得到init参数错误

TypeError: __init__() takes at least 4 arguments (4 given)
代码如下:

from spark_sklearn import GridSearchCV

gsearch2 = GridSearchCV(estimator=ensemble.GradientBoostingRegressor(**params), param_grid=param_test2, n_jobs=1)
如果我为
GridSearchCV
提供更多参数,例如add
cv=5
,则错误将变为

TypeError: __init__() takes at least 4 arguments (5 given)
有什么建议吗


谢谢。

GridSearchCV.\uuuu init\uuuu
采用:

  • sc
    -
    SparkContext
  • 估计器
  • 参数网格
您忘记了SparkContext的

GridSearchCV(
    sc=SparkContext.getOrCreate(),
    estimator=ensemble.GradientBoostingRegressor(**params), 
    param_grid=param_test2, n_jobs=1)