我在PySpark中拟合了一个PCA模型,我需要从模型对象中得到组件的数量。你知道吗
from pyspark.ml.feature import PCA
pca = PCA(k=5, inputCol='features', outputCol='components')
pca_model = pca.fit(data)
我试过使用pca_model.k
和pca_model.getParam('k')
,但是没有一个能给出组件的数量。你知道吗
>>> pca_model.k
Param(parent='PCA_4e66a98132a4fe4ad86c', name='k', doc='the number of principal components (> 0)')
>>> pca_model.getParam('k')
Param(parent='PCA_4e66a98132a4fe4ad86c', name='k', doc='the number of principal components (> 0)')
如何从PySpark的PCAModel
对象获得组件的数量?你知道吗
您可以使用它的Java模型:
或
getOrDefault
方法:相关问题 更多 >
编程相关推荐