from sklearn.decomposition import FactorAnalysis
fa = FactorAnalysis(n_components=k, random_state=0)
# Check the dimension
# It should be (n_features, n_components)
fa.components_.T.shape
# Check equation
# It should be all True
fa.components_.T @ fa.components_ + np.diag(fa.noise_variance_) == fa.get_covariance()
我猜是
components_
是因子载荷。我以前只在R中应用过这个算法。我不确定这是Python中的加载。作为检查,荷载应满足方程式Cov = LL^T + Sigma
。在python中,它是有关更多详细信息,请参阅本文件https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.FactorAnalysis.html#sklearn.decomposition.FactorAnalysis
相关问题 更多 >
编程相关推荐