FactorAnalysis
#include <Skigen/Decomposition>
template <typename Scalar = double>
class Skigen::FactorAnalysis(n_components=0, max_iter=1000, tol=1e-3)
Factor Analysis estimator.
Estimates a covariance model of the form:
where is the loading matrix (n_features × n_components) and are the per-feature noise variances.
Uses the Expectation-Maximization (EM) algorithm:
Mirrors sklearn.decomposition.FactorAnalysis.
Parameters:
-
n_components : int, default=0 Number of latent factors (0 = auto).
-
max_iter : int, default=1000 Maximum EM iterations.
-
tol : Scalar, default=1e-3 Convergence tolerance on log-likelihood change.
Attributes:
-
components : MatrixType Loading matrix W of shape (n_features, n_components).
-
noise_variance : VectorType Per-feature noise variances ψ of length n_features.
-
covariance : MatrixType Estimated covariance matrix (n_features × n_features).
-
log_likelihood : Scalar Final log-likelihood of the fitted model.
-
n_iter : int Number of EM iterations performed.
Methods
SKIGEN_PARAMS()
Fit the factor analysis model via EM.
Parameters:
- X Data matrix of shape (n_samples, n_features).
Returns:
- result
Reference to the fitted estimator (
*this).
score(X)
Return the Gaussian log-likelihood of X under the fitted model.
Parameters:
- X : MatrixType Data matrix of shape (n_samples, n_features).
Returns:
- result : Scalar Average log-likelihood per sample.