consensuscluster.TemplateTransformer

class consensuscluster.TemplateTransformer(demo_param='demo')[source]

An example transformer that returns the element-wise square root.

For more information regarding how to build your own transformer, read more in the User Guide.

Parameters
demo_paramstr, default=’demo’

A parameter used for demonstation of how to pass and store paramters.

Attributes
n_features_int

The number of features of the data passed to fit().

__init__(self, demo_param='demo')[source]

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

fit(self, X, y=None)[source]

A reference implementation of a fitting function for a transformer.

Parameters
X{array-like, sparse matrix}, shape (n_samples, n_features)

The training input samples.

yNone

There is no need of a target in a transformer, yet the pipeline API requires this parameter.

Returns
selfobject

Returns self.

fit_transform(self, 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
Xnumpy array of shape [n_samples, n_features]

Training set.

ynumpy array of shape [n_samples]

Target values.

Returns
X_newnumpy array of shape [n_samples, n_features_new]

Transformed array.

get_params(self, deep=True)

Get parameters for this estimator.

Parameters
deepboolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns
paramsmapping of string to any

Parameter names mapped to their values.

set_params(self, **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.

Returns
self
transform(self, X)[source]

A reference implementation of a transform function.

Parameters
X{array-like, sparse-matrix}, shape (n_samples, n_features)

The input samples.

Returns
X_transformedarray, shape (n_samples, n_features)

The array containing the element-wise square roots of the values in X.

Examples using consensuscluster.TemplateTransformer