Skip to content

Commit 7cfc247

Browse files
authored
Minor fixes to template estimators
1 parent 8a8797c commit 7cfc247

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

skltemplate/template.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TemplateEstimator(BaseEstimator):
1717
A parameter used for demonstation of how to pass and store paramters.
1818
"""
1919
def __init__(self, demo_param='demo_param'):
20-
self.demo_param = 'demo_param'
20+
self.demo_param = demo_param
2121

2222
def fit(self, X, y):
2323
"""A reference implementation of a fitting function
@@ -29,12 +29,14 @@ def fit(self, X, y):
2929
y : array-like, shape = [n_samples] or [n_samples, n_outputs]
3030
The target values (class labels in classification, real numbers in
3131
regression).
32+
3233
Returns
3334
-------
3435
self : object
3536
Returns self.
3637
"""
3738
X, y = check_X_y(X, y)
39+
# Return the estimator
3840
return self
3941

4042
def predict(self, X):
@@ -81,6 +83,7 @@ def fit(self, X, y):
8183
The training input samples.
8284
y : array-like, shape = [n_samples]
8385
The target values. An array of int.
86+
8487
Returns
8588
-------
8689
self : object
@@ -143,8 +146,10 @@ def fit(self, X, y=None):
143146
----------
144147
X : array-like or sparse matrix of shape = [n_samples, n_features]
145148
The training input samples.
146-
y : array-like, shape = [n_samples]
147-
The target values. An array of int.
149+
y : None
150+
There is no need of a target in a transformer, yet the pipeline API
151+
requires this parameter.
152+
148153
Returns
149154
-------
150155
self : object
@@ -154,7 +159,7 @@ def fit(self, X, y=None):
154159

155160
self.input_shape_ = X.shape
156161

157-
# Return the classifier
162+
# Return the transformer
158163
return self
159164

160165
def transform(self, X):

0 commit comments

Comments
 (0)