gemseo / mlearning / transform / dimension_reduction

kpca module

The Kernel Principal Component Analysis (KPCA) to reduce the dimension of a variable.

The KPCA class implements the KCPA wraps the KPCA from Scikit-learn.

Dependence

This dimension reduction algorithm relies on the PCA class of the scikit-learn library.

Classes:

KPCA([name, n_components, ...])

Kernel principal component dimension reduction algorithm.

class gemseo.mlearning.transform.dimension_reduction.kpca.KPCA(name='KPCA', n_components=5, fit_inverse_transform=True, kernel='linear', **parameters)[source]

Bases: gemseo.mlearning.transform.dimension_reduction.dimension_reduction.DimensionReduction

Kernel principal component dimension reduction algorithm.

name

The name of the transformer.

Type

str

parameters

The parameters of the transformer.

Type

str

Parameters
  • fit_inverse_transform

    If True, learn the inverse transform for non-precomputed kernels.

    By default it is set to True.

  • kernel

    The name of the kernel, either ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘cosine’ or ‘precomputed’.

    By default it is set to linear.

  • **parameters – The optional parameters for sklearn KPCA constructor.

Attributes:

CROSSED

n_components

The number of components.

Methods:

compute_jacobian(data)

Compute Jacobian of transformer.transform().

compute_jacobian_inverse(data)

Compute Jacobian of the transformer.inverse_transform().

duplicate()

Duplicate the current object.

fit(data, *args)

Fit the transformer to the data.

fit_transform(data, *args)

Fit the transformer to the data and transform the data.

inverse_transform(data)

Perform an inverse transform on the data.

transform(data)

Transform the data.

CROSSED = False
compute_jacobian(data)

Compute Jacobian of transformer.transform().

Parameters

data (numpy.ndarray) – The data where the Jacobian is to be computed.

Returns

The Jacobian matrix.

Return type

NoReturn

compute_jacobian_inverse(data)

Compute Jacobian of the transformer.inverse_transform().

Parameters

data (numpy.ndarray) – The data where the Jacobian is to be computed.

Returns

The Jacobian matrix.

Return type

NoReturn

duplicate()

Duplicate the current object.

Returns

A deepcopy of the current instance.

Return type

gemseo.mlearning.transform.transformer.Transformer

fit(data, *args)[source]

Fit the transformer to the data.

Parameters
  • data (numpy.ndarray) – The data to be fitted.

  • *args (Union[float, int, str]) –

Return type

None

fit_transform(data, *args)

Fit the transformer to the data and transform the data.

Parameters
  • data (numpy.ndarray) – The data to be transformed.

  • *args (Union[float, int, str]) –

Returns

The transformed data.

Return type

numpy.ndarray

inverse_transform(data)[source]

Perform an inverse transform on the data.

Parameters

data (numpy.ndarray) – The data to be inverse transformed.

Returns

The inverse transformed data.

Return type

numpy.ndarray

property n_components

The number of components.

transform(data)[source]

Transform the data.

Parameters

data (numpy.ndarray) – The data to be transformed.

Returns

The transformed data.

Return type

numpy.ndarray