因子分析 Scikit

Factor Analysis Scikit

我正在尝试对一些财务数据使用 scikit 的因子分析来找到要在模型中使用的贝塔值。 FA 有一个名为 n_components 的参数和公差。我在思考这些变量如何影响结果时遇到了一些麻烦。我已阅读文档并进行了研究,但无法找到任何相关信息。我是机器学习的新手,不是统计向导。有人可以解释一下这些如何影响算法的结果吗?

来自sklearn.decomposition.FactorAnalysis

n_components : int | None

Dimensionality of latent space, the number of components of X that are obtained after transform. If None, n_components is set to the number of features.

tol : float Stopping tolerance for EM algorithm.

我假设您的财务数据是 (n_samples, n_features) 形状的矩阵。因子分析使用期望最大化 (EM) 优化器来找到最佳高斯分布,该分布可以在 n_tolerance 的公差范围内准确地对数据建模。简单来说n_components就是高斯分布的维数。

可以用高斯分布建模的数据有时在一个维度上的方差可以忽略不计。想象一个沿其深度被压扁的椭圆体,使其看起来像一个椭圆。如果原始数据是椭圆体,您需要 n_components = 2,这样您就可以使用最不复杂的模型对数据进行建模。