Principal Component Analysis

This module provides functionality for principal component analysis.

class breze.learn.pca.Pca(n_components=None, whiten=False)

Class to perform principal component analysis.

Attributes

n_components (integer) Number of components to keep.
whiten (boolean) Flag indicating whether to whiten the covariance matrix.
weights (array_like) 2D array representing the map from observable to latent space.
singular_values (array_like) 1D array containing the singular values of the problem.

Methods

fit(X) Fit the parameters of the model.
inverse_transform(F) Perform an inverse transformation of transformed data according to the model.
reconstruct(X) Reconstruct the data according to the model.
transform(X) Transform data according to the model.
__init__(n_components=None, whiten=False)

Create a Pca object.

fit(X)

Fit the parameters of the model.

The data should be centered (that is, its mean subtracted rowwise) before using this method.

Parameters:

X : array_like

An array of shape (n, d) where n is the number of data points and d the input dimensionality.

inverse_transform(F)

Perform an inverse transformation of transformed data according to the model.

Parameters:

F : array_like

An array of shape (n, d) where n is the number of data points and d the dimensionality if the feature space.

Returns:

X : array_like

An array of shape (n, c) where n is the number of samples and c is the dimensionality of the input space.

reconstruct(X)

Reconstruct the data according to the model.

Parameters:

X : array_like

An array of shape (n, d) where n is the number of data points and d the input dimensionality.

Returns:

Y : array_like

An array of shape (n, d) where n is the number of samples and d is the dimensionality of the input space.

transform(X)

Transform data according to the model.

Parameters:

X : array_like

An array of shape (n, d) where n is the number of data points and d the input dimensionality.

Returns:

Y : array_like

An array of shape (n, c) where n is the number of samples and c is the number of components kept.

class breze.learn.pca.Zca(min_eig_val=0.1)

Class to perform zero component analysis.

Attributes

min_eig_val (float) Eigenvalues are increased by this value before reconstructing.
weights (array_like) 2D array representing the map from observable to latent space.
singular_values (array_like) 1D array containing the singular values of the problem.

Methods

fit(X) Fit the parameters of the model.
inverse_transform(F) Perform an inverse transformation of transformed data according to the model.
reconstruct(X) Reconstruct the data according to the model.
transform(X) Transform data according to the model.
__init__(min_eig_val=0.1)

Create a Zca object.

fit(X)

Fit the parameters of the model.

The data should be centered (that is, its mean subtracted rowwise) before using this method.

inverse_transform(F)

Perform an inverse transformation of transformed data according to the model.

Parameters:

F : array_like

An array of shape (n, d) where n is the number of data points and d the dimensionality if the feature space.

Returns:

X : array_like

An array of shape (n, c) where n is the number of samples and c is the dimensionality of the input space.

reconstruct(X)

Reconstruct the data according to the model.

Parameters:

X : array_like

An array of shape (n, d) where n is the number of data points and d the input dimensionality.

Returns:

Y : array_like

An array of shape (n, d) where n is the number of samples and d is the dimensionality of the input space.

transform(X)

Transform data according to the model.

Parameters:

X : array_like

An array of shape (n, d) where n is the number of data points and d the input dimensionality.

Returns:

Y : array_like

An array of shape (n, c) where n is the number of samples and c is the number of components kept.