skltemplate
.TemplateEstimator¶
-
class
skltemplate.
TemplateEstimator
(demo_param='demo_param')[source]¶ 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 demonstation of how to pass and store paramters.
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(demo_param='demo_param')
-
__init__
(self, demo_param='demo_param')[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
fit
(self, X, y)[source]¶ 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_params
(self, 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
- paramsmapping of string to any
Parameter names mapped to their values.
-
predict
(self, X)[source]¶ 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
(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.- Parameters
- **paramsdict
Estimator parameters.
- Returns
- selfobject
Estimator instance.