How to get best params after tuning by pyspark.ml.tuning.TrainValidationSplit?

浪尽此生 提交于 2019-12-01 12:56:51

You can access best model using bestModel property of the TrainValidationSplitModel:

best_model = model.bestModel

Rank can be accessed directly using rank property of the ALSModel:

best_model.rank
10

Getting maximum number of iterations requires a bit more trickery:

(best_model
    ._java_obj     # Get Java object
    .parent()      # Get parent (ALS estimator)
    .getMaxIter()) # Get maxIter
10
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!