我正在使用sklearn.decomposition FactorAnalysis对我的股票回报矩阵(200x676)进行因子分析,我有三个函数: fit,transform和transform_fit,我应该使用哪一个函数来获得因子负载?
发布于 2020-01-17 17:05:43
我猜components_就是因子加载。我以前只在R中应用过这个算法。我不确定是不是Python中的加载。作为检查,加载应该满足等式Cov = LL^T + Sigma。在python中,它是
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()有关更多详细信息,请参阅本文档https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.FactorAnalysis.html#sklearn.decomposition.FactorAnalysis。
https://stackoverflow.com/questions/59782879
复制相似问题