TemplateEstimator#

class skltemplate.TemplateEstimator(demo_param='demo_param')#

A template estimator to be used as a reference implementation.

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

Parameters:
demo_paramstr, default=’demo_param’

A parameter used for demonstration of how to pass and store parameters.

Examples

>>> from skltemplate import TemplateEstimator
>>> import numpy as np
>>> X = np.arange(100).reshape(100, 1)
>>> y = np.zeros((100, ))
>>> estimator = TemplateEstimator()
>>> estimator.fit(X, y)
TemplateEstimator()
Attributes:
is_fitted_bool

A boolean indicating whether the estimator has been fitted.

n_features_in_int

Number of features seen during fit.

feature_names_in_ndarray of shape (n_features_in_,)

Names of features seen during fit. Defined only when X has feature names that are all strings.

Methods

fit(X, y)

A reference implementation of a fitting function.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

predict(X)

A reference implementation of a predicting function.

set_params(**params)

Set the parameters of this estimator.

fit(X, y)#

A reference implementation of a fitting function.

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

The training input samples.

yarray-like, shape (n_samples,) or (n_samples, n_outputs)

The target values (class labels in classification, real numbers in regression).

Returns:
selfobject

Returns self.

get_metadata_routing()#

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:
routingMetadataRequest

A MetadataRequest encapsulating routing information.

get_params(deep=True)#

Get parameters for this estimator.

Parameters:
deepbool, default=True

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

Returns:
paramsdict

Parameter names mapped to their values.

predict(X)#

A reference implementation of a predicting function.

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

The training input samples.

Returns:
yndarray, shape (n_samples,)

Returns an array of ones.

set_params(**params)#

Set the parameters of this estimator.

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

Parameters:
**paramsdict

Estimator parameters.

Returns:
selfestimator instance

Estimator instance.

Examples using skltemplate.TemplateEstimator#

Plotting Template Estimator

Plotting Template Estimator