Projection

class gtda.mapper.Projection(columns=0)[source]

Projection onto specified columns.

In practice, this simply means returning a selection of columns of the data.

Parameters

columns (int or list of int, optional, default: 0) – The column indices of the array to project onto.

__init__(columns=0)[source]

Initialize self. See help(type(self)) for accurate signature.

fit(X, y=None)[source]

Do nothing and return the estimator unchanged.

This method exists to implement the usual scikit-learn API and hence work in pipelines.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input data.

  • y (None) – There is no need for a target in a transformer, yet the pipeline API requires this parameter.

Returns

self

Return type

object

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input data.

  • y (None) – There is no need for a target in a transformer, yet the pipeline API requires this parameter.

Returns

Xt – Output array, where n_columns = len(columns).

Return type

ndarray of shape (n_samples, n_columns)

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

mapping of string to any

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

object

transform(X, y=None)[source]

Return selected columns of the data.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input data.

  • y (None) – There is no need for a target in a transformer, yet the pipeline API requires this parameter.

Returns

Xt – Output array, where n_columns = len(columns).

Return type

ndarray of shape (n_samples, n_columns)