Is it possible to access estimator attributes in spark.ml pipelines?

与世无争的帅哥 提交于 2019-11-29 01:42:32

Answering my own question...I finally stumbled on an example deep in the spark.ml docs that shows how to do this using the stages member of the PipelineModel class. So for the example I posted above, in order to access the k-means cluster centers, do:

val centers = fitKmeans.stages(2).asInstanceOf[KMeansModel].clusterCenters

where fitKmeans is a PipelineModel and 2 is the index of the k-means model in the array of pipeline stages.

Reference: the last line of most of the examples on this page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!