PCA

Application Programming Interface

class pypr.preprocessing.PCA(X, normalize=True, whitening=False, **kwargs)

Principal Component Analysis (PCA)

Parameters :

X : np array

Expects an array X with samples row wise and features column wise. The eigen values and normalization used by the PCA are based upon X.

normalize : bool, optional

Optional input normalize specifies if the input data X should be normalized before the PCA transform.

whitening : bool, optional

If whitening is true, then the outputs are scaled so that they have zero mean and unity standard deviation. (NOT IMPLEMENTED)

Methods

get_eig
invtransform
transform
get_eig()

Eigen values.

Returns :

w : np array

Eigenvalues (length equal to number of inputs in X, D)

v : np array

Eigenvectors in a DxD sized matrix. Vectors a columns.

The eigenvectors (columns) are sorted after eigenvalues in descending order.

invtransform(Z, skipnormalization=False)

Returns Z projected back in to the original vector space.

Parameters :

Z : np array

Projected data. Samples row-wise.

Returns :

X : np array

Z transformed to original vector space.

transform(X, dim=0, skipnormalization=False)

Projects X into the new vector space found by the PCA.

Parameters :

X : np array

Samples to be projected by PCA. Samples row-wise, inputs column- wise.

dim : int, optional

The number of most significant dimensions to return. If dim is zero, then all dimensions are returned.

Returns :

Z : np array

Returns new projection of data. Samples row-wise, and dim columns.

Table Of Contents

This Page