ProbabilisticPCA<T>

Models & Types · AiDotNet.Preprocessing.DimensionalityReduction

Probabilistic Principal Component Analysis (PPCA).

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → ProbabilisticPCA<T>

For Beginners

PPCA extends standard PCA by:

  • Providing a probabilistic model for the data
  • Estimating noise variance σ² separately
  • Enabling computation of data likelihoods
  • Handling missing values naturally

Use cases:

  • When you need uncertainty estimates
  • Data with missing values
  • Model comparison using likelihoods
  • Bayesian machine learning pipelines

How It Works

Probabilistic PCA is a probabilistic formulation of PCA that models data as being generated from a lower-dimensional latent space with added Gaussian noise. This provides a proper likelihood model, enables handling of missing data, and allows for Bayesian extensions.

The model: x = W * z + μ + ε where z ~ N(0, I), ε ~ N(0, σ²I)

The algorithm:

  1. Center the data
  2. Use EM algorithm or closed-form solution to estimate W and σ²
  3. Project data to latent space using posterior mean

Constructors

Constructor Summary
ProbabilisticPCA(int nComponents, int maxIter, double tol, int? randomState, int[] columnIndices) Creates a new instance of ProbabilisticPCA.

Properties

Property Summary
Matrix<T> LoadingMatrix { get; } Gets the loading matrix W.
T NoiseVariance { get; } Gets the estimated noise variance.
bool SupportsInverseTransform { get; } Gets whether this transformer supports inverse transformation.
int NComponents { get; } Gets the number of components (dimensions).

Methods

Method Summary
T Score(Matrix<T> data) Computes the log-likelihood of the data under the model.
string[] GetFeatureNamesOut(string[] inputFeatureNames) Gets the output feature names after transformation.