PCA#

Implements Principal Component Analysis (PCA) to fit the spatial statistics of a time series of images. Used by the ReVAR and Long-Range AutoRegression modules.

This module can be used to both i) compute PCA from data and ii) generate synthetic data images with the same spatial statistics as input data.

Functions#

Functions:

find_top_principal_components(pc_variances, ...)

Finds the top principal components containing the given percentage of the total variance.

compute_pca(data)

Computes the principal components and their associated variances for an input array containing samples of a multivariate Gaussian distribution.

generative_pca_algorithm(num_samples, ...[, ...])

Generates samples from a multivariate Gaussian distribution.

aomodel.pca.compute_pca(data)[source]#

Computes the principal components and their associated variances for an input array containing samples of a multivariate Gaussian distribution. Takes the Singular Value Decomposition (SVD) of the covariance matrix.

Parameters:

data (ndarray) – numpy 2-D array of shape (vector dimensionality, number of samples) containing samples of the multivariable Gaussian distribution.

Returns:

  • data_mean (ndarray) – numpy 1-D array of shape (vector dimensionality,) containing the sample mean vector (i.e., the sample mean of each vector component).

  • principal_components (ndarray) – numpy 2-D array of shape (vector dimensionality, vector dimensionality) containing the principal component matrix. The principal components are the columns of this matrix.

  • pc_variances (ndarray) – numpy 1-D array of shape (vector dimensionality,) containing the variance of each principal component.

aomodel.pca.find_top_principal_components(pc_variances, percent_variance)[source]#

Finds the top principal components containing the given percentage of the total variance.

Parameters:
  • pc_variances (ndarray) – numpy 1-D array containing the variance of each principal component.

  • percent_variance (float) – percentage of the total variance to look for.

Returns:

num_components (int) – the number of top principal components containing the given percentage of the total variance.

aomodel.pca.generative_pca_algorithm(num_samples, covariance_modulation_matrix, mean_vector=None)[source]#

Generates samples from a multivariate Gaussian distribution. This uses the PCA generative algorithm, which generates white noise vectors and then (1) multiplies them by a modulation matrix to set the covariance matrix and (2) adds the mean vectors.

Parameters:
  • num_samples (int) – number of samples to generate.

  • covariance_modulation_matrix (ndarray) – numpy 2-D array of shape (random vector dimensionality, random vector dimensionality) containing a matrix which scales unit-variance white noise to have the desired spatial covariance matrix. This matrix is determined by the matrices of principal components their variances.

  • mean_vector (ndarray, optional) – [Default=None] numpy 1-D array of shape (random vector dimensionality,) containing the mean of the distribution.

    • If set to None, a mean vector of zero is used.

Returns:

samples (ndarray) – 2-D array of shape (random vector dimensionality, num_samples) whose columns contain samples from the desired multivariate Gaussian distribution.


Disclaimer: Approved for public release; distribution is unlimited. Public Affairs release approval # AFRL-2026-1309.