imfun.pica

imfun.pica.pca(X, ncomp=None)

PCA decomposition via SVD

Input:
  • X – an array where each column contains observations from one measurement

    and each row is a different probe (dimension)

Output:
  • Z – whitened matrix
  • K – PC matrix
  • s – eigenvalues
  • X_mean – sample mean
imfun.pica.st_ica(X, ncomp=20, mu=0.2, npca=None, reshape_filters=True)

Spatiotemporal ICA for sequences of images

Input:
  • X – list of 2D arrays or 3D array with first axis = time
  • ncomp – number of components to resolve
  • mu – weight of temporal input, mu = 0 -> spatial; mu = 1 -> temporal
  • npca – number of principal components to calculate (default, equals to the number of independent components
  • reshape_filters – if true, ICA filters are returned as a sequence of images (3D array, Ncomponents x Npx x Npy)
Output:
  • ica_filters, ica_signals
imfun.pica.fastica(X, ncomp=None, whiten=True, algorithm='symmetric', nonlinfn={'gprime': <function <lambda> at 0x7fcac6e2a758>, 'g': <function <lambda> at 0x7fcac6e2a6e0>}, tol=0.0001, max_iter=1000.0, guess=None)

Fast ICA algorithm realisation.

Input:
  • X – data matrix with observations in rows
  • ncomp – number of components to resolve [all possible]
  • whiten – whether to whiten the input data
  • nonlinfn – nonlinearity function [pow3nonlin]
  • tol – finalisation tolerance, [1e-04]
  • max_iter – maximal number of iterations [1000]
  • guess – initial guess [None]
Output:
  • S – estimated sources (in rows)
  • W – unmixing matrix