Я уменьшаю размерность a Spark DataFrame
с помощью модели PCA
с pyspark (используя библиотеку spark
ml
) следующим образом:
pca = PCA(k=3, inputCol="features", outputCol="pca_features")
model = pca.fit(data)
где data
- это Spark DataFrame
с одним столбцом, который находится под напряжением features
, который является DenseVector
трех измерений:
data.take(1)
Row(features=DenseVector([0.4536,-0.43218, 0.9876]), label=u'class1')
После установки я преобразую данные:
transformed = model.transform(data)
transformed.first()
Row(features=DenseVector([0.4536,-0.43218, 0.9876]), label=u'class1', pca_features=DenseVector([-0.33256, 0.8668, 0.625]))
Мой вопрос: как я могу извлечь собственные векторы этого СПС? Как я могу рассчитать, сколько объяснений они объясняют?