我在Pyspark上工作,我使用带有ALS算法的GridSearchCV
但是我得到了一个错误..有什么帮助吗?
谢谢
als = ALS(maxIter=5, regParam=0.01, userCol="userId", itemCol="movieId", ratingCol="rating",
coldStartStrategy="drop")
param_grid = {'rank': [10,50,100,150],
'regParam': [0.01,0.05,0.1,0.15]}
# run grid search
grid_search = GridSearchCV(als, param_grid=param_grid, scoring='accuracy')
start = time()
model_gridSeach=grid_search.fit(features_train,lable_train)
print("GridSearchCV took %.2f seconds for %d candidate parameter settings."
% (time() - start, len(grid_search.cv_results_['params'])))
report(grid_search.cv_results_)输出:
Cannot clone object 'ALS_855af664ffc8' (type <class 'pyspark.ml.recommendation.ALS'>):
it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.发布于 2020-06-12 04:03:03
正如您的输出所示,创建的als对象属于类pyspark.ml.recommendation.ALS,而不是来自类sklearn.model_selection.GridSearchCV:https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html的estimator对象。
https://stackoverflow.com/questions/60211437
复制相似问题