Skip to content

Commit feb46a0

Browse files
committed
wip: docstring
1 parent 8101692 commit feb46a0

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

examples/multitask_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
Y = np.array(n*[y]).T
1414

1515
mt = MultiTaskEstimator(
16-
# estimator=MultiTaskLassoCV(alphas=np.logspace(-3, 3, 7)),
17-
estimator=MultiTaskElasticNetCV(),
18-
output_types=n*['binary'])
16+
estimator=MultiTaskLassoCV(alphas=np.logspace(-3, 3, 7)),
17+
output_types=n*['binary'])
1918

2019
mt.fit(X, Y)
2120
print(mt.score(X, Y))

stlearn/multitask.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ def predict(self, X):
5555
return Ypred
5656

5757
def score(self, X, Y):
58+
"""Returns accuracy for each outputs.
59+
60+
r2_score is used for continuous outputs,
61+
accuracy_score is used for binary outputs.
62+
63+
Parameters
64+
----------
65+
X : array-like, shape = (n_samples, n_features)
66+
The multi-input samples.
67+
68+
y : array-like, shape = (n_samples) or (n_samples, n_outputs)
69+
True labels for X.
70+
71+
Returns
72+
-------
73+
score : list of float, shape (n_outputs,)
74+
Mean accuracy of self.predict(X) wrt. Y.
75+
"""
5876
# predict multiple outputs
5977
# accuracy for regression and classification
6078
Ypred = self.predict(X)

stlearn/stacking.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
def stack_features(X):
1616
"""Stack features from sources
1717
18-
Parameters:
19-
-----------
18+
Parameters
19+
----------
2020
X : a list of 2d matrices
2121
22-
Returns:
23-
--------
24-
- Xstacked : (n_samples x (n_features*n_sources)) stacked 2d matrix
22+
Returns
23+
-------
24+
Xstacked : (n_samples x (n_features*n_sources)) stacked 2d matrix
2525
26-
- features_indices : (n_features*n_sources) list of indices
26+
features_indices : (n_features*n_sources) list of indices
2727
"""
2828
X_stacked = np.hstack(X)
2929

0 commit comments

Comments
 (0)