Skip to main content

Convolutional version of PCA using Power Iteration, FastICA and Autoencoders.

Project description

convPCA

Various approaches to performing a convolutional analogue of PCA. The basic idea is to adapt power iteration (PI). PI finds the eigenvectors of A by initializing a random h and then iteratively setting h = norm(Ah) where norm(g)=g/sum(g^2) to have unit length.
In the PCA context, A is the empirical covariance, A=(X'X)/N. So we can equivalently update h = X'(Xh) [with the divide by N coming out in the wash when we normalize h]. The idea in convolutional PCA is to replace matrix multiplication with convolution operations. For 1D sequence data

  • X is [N x P x L]
  • h is [H x P x K]

where

  • N is the number of sample sequences,
  • P is the number of observed channels,
  • L is the sequence length,
  • H is the number of hidden channels/factors (1 for standard PI), and
  • K is the PC/PWM/factor size/filter width.

The basic PI algorithm iterates

  1. b = F.conv_transpose1d(x,h.transpose(0,1)) gives a [N x H x L+K-1] tensor (think of this as hidden node activations in an AE).
  2. h = F.conv1d(b.transpose(0,1),x.transpose(0,1)) gives an updated h with the correct dimensions (this is like correlating the activations and the observed data).

There are two approaches to extending to H>1:

  1. Orthonormalizing h at every iteration using QR decomposition or SVD.
  2. "Deflating" X, i.e. removing signal explained by the previous PCs. For PCA these approaches are equivalent, not clear if this is true for convPCA (and it's certainly not for the sparse variant).

Other implemented features:

  • sparse version, where all but the largest element in windows of b are zeroed out
  • shift version, where we attempt to center the PWM to avoid cutting off a position at the edge
  • batch version ala AdaOja

A couple of other approaches to fitting are implemented:

  • A novel convolutional version of FastICA very analogous to ConvPCA. This includes a L1-penalty/lasso inspired nonlinearity (soft thresholding).
  • A (shallow, linear) convolutional autoencoder, fit using SGD/Adam.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convPCA-0.0.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convPCA-0.0.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file convPCA-0.0.1.tar.gz.

File metadata

  • Download URL: convPCA-0.0.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.0

File hashes

Hashes for convPCA-0.0.1.tar.gz
Algorithm Hash digest
SHA256 73028eedbf2b5b52838c62276d3482bd562d0abfb75dce40651c96164d52e4a6
MD5 5e47b22395f1c0fffda6a692bbf37237
BLAKE2b-256 ac8d45aaeb977de4a4086f63e284b530cb9c6789c362293989ec0af3b544c44b

See more details on using hashes here.

File details

Details for the file convPCA-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: convPCA-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.0

File hashes

Hashes for convPCA-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00341ea89b9a58c776d3bb3f63b36cde4e80435c27a188c5e4fcb50e3ab09519
MD5 c5ae0a0c6f15f12cced3c451b408b504
BLAKE2b-256 0efb750e18037391560510d01380c733df1ac68f3cf6c4b6b5a8af9d523e0b10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page