Skip to content

Commit d0ea44d

Browse files
committed
adding space to shape and putting // in average division
1 parent d6c9129 commit d0ea44d

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

Diff for: benchmarks/bench_sgd_regression.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
clf = SGDRegressor(alpha=alpha / n_train, fit_intercept=False,
9494
n_iter=n_iter, learning_rate="invscaling",
9595
eta0=.002, power_t=0.05,
96-
average=(n_iter * n_train / 2))
96+
average=(n_iter * n_train // 2))
9797

9898
tstart = time()
9999
clf.fit(X_train, y_train)
@@ -122,7 +122,7 @@
122122
pl.plot(list_n_samples, np.sqrt(sgd_results[:, j, 0]),
123123
label="SGDRegressor")
124124
pl.plot(list_n_samples, np.sqrt(asgd_results[:, j, 0]),
125-
label="A-SGD")
125+
label="A-SGDRegressor")
126126
pl.plot(list_n_samples, np.sqrt(ridge_results[:, j, 0]),
127127
label="Ridge")
128128
pl.legend(prop={"size": 10})
@@ -137,7 +137,7 @@
137137
pl.plot(list_n_samples, np.sqrt(sgd_results[:, j, 1]),
138138
label="SGDRegressor")
139139
pl.plot(list_n_samples, np.sqrt(asgd_results[:, j, 1]),
140-
label="A-SGD")
140+
label="A-SGDRegressor")
141141
pl.plot(list_n_samples, np.sqrt(ridge_results[:, j, 1]),
142142
label="Ridge")
143143
pl.legend(prop={"size": 10})

Diff for: sklearn/linear_model/stochastic_gradient.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -494,18 +494,18 @@ def partial_fit(self, X, y, classes=None, sample_weight=None):
494494
X : {array-like, sparse matrix}, shape (n_samples, n_features)
495495
Subset of the training data
496496
497-
y : numpy array, shape (n_samples,)
497+
y : numpy array, shape (n_samples, )
498498
Subset of the target values
499499
500-
classes : array, shape (n_classes,)
500+
classes : array, shape (n_classes, )
501501
Classes across all calls to partial_fit.
502502
Can be obtained by via `np.unique(y_all)`, where y_all is the
503503
target vector of the entire dataset.
504504
This argument is required for the first call to partial_fit
505505
and can be omitted in the subsequent calls.
506506
Note that y doesn't need to contain all labels in `classes`.
507507
508-
sample_weight : array-like, shape (n_samples,), optional
508+
sample_weight : array-like, shape (n_samples, ), optional
509509
Weights applied to individual samples.
510510
If not provided, uniform weights are assumed.
511511
@@ -527,16 +527,16 @@ def fit(self, X, y, coef_init=None, intercept_init=None,
527527
X : {array-like, sparse matrix}, shape (n_samples, n_features)
528528
Training data
529529
530-
y : numpy array, shape (n_samples,)
530+
y : numpy array, shape (n_samples, )
531531
Target values
532532
533533
coef_init : array, shape (n_classes,n_features)
534534
The initial coefficients to warm-start the optimization.
535535
536-
intercept_init : array, shape (n_classes,)
536+
intercept_init : array, shape (n_classes, )
537537
The initial intercept to warm-start the optimization.
538538
539-
sample_weight : array-like, shape (n_samples,), optional
539+
sample_weight : array-like, shape (n_samples, ), optional
540540
Weights applied to individual samples.
541541
If not provided, uniform weights are assumed.
542542
@@ -672,7 +672,7 @@ class SGDClassifier(BaseSGDClassifier, _LearntSelectorMixin):
672672
n_features)
673673
Weights assigned to the features.
674674
675-
intercept_ : array, shape (1,) if n_classes == 2 else (n_classes,)
675+
intercept_ : array, shape (1, ) if n_classes == 2 else (n_classes, )
676676
Constants in decision function.
677677
678678
Examples
@@ -888,10 +888,10 @@ def partial_fit(self, X, y, sample_weight=None):
888888
X : {array-like, sparse matrix}, shape (n_samples, n_features)
889889
Subset of training data
890890
891-
y : numpy array of shape (n_samples,)
891+
y : numpy array of shape (n_samples, )
892892
Subset of target values
893893
894-
sample_weight : array-like, shape (n_samples,), optional
894+
sample_weight : array-like, shape (n_samples, ), optional
895895
Weights applied to individual samples.
896896
If not provided, uniform weights are assumed.
897897
@@ -938,16 +938,16 @@ def fit(self, X, y, coef_init=None, intercept_init=None,
938938
X : {array-like, sparse matrix}, shape (n_samples, n_features)
939939
Training data
940940
941-
y : numpy array, shape (n_samples,)
941+
y : numpy array, shape (n_samples, )
942942
Target values
943943
944-
coef_init : array, shape (n_features,)
944+
coef_init : array, shape (n_features, )
945945
The initial coefficients to warm-start the optimization.
946946
947-
intercept_init : array, shape (1,)
947+
intercept_init : array, shape (1, )
948948
The initial intercept to warm-start the optimization.
949949
950-
sample_weight : array-like, shape (n_samples,), optional
950+
sample_weight : array-like, shape (n_samples, ), optional
951951
Weights applied to individual samples (1. for unweighted).
952952
953953
Returns
@@ -969,7 +969,7 @@ def decision_function(self, X):
969969
970970
Returns
971971
-------
972-
array, shape (n_samples,)
972+
array, shape (n_samples, )
973973
Predicted target values per element in X.
974974
"""
975975
X = check_array(X, accept_sparse='csr')
@@ -987,7 +987,7 @@ def predict(self, X):
987987
988988
Returns
989989
-------
990-
array, shape (n_samples,)
990+
array, shape (n_samples, )
991991
Predicted target values per element in X.
992992
"""
993993
return self.decision_function(X)
@@ -1159,16 +1159,16 @@ class SGDRegressor(BaseSGDRegressor, _LearntSelectorMixin):
11591159
11601160
Attributes
11611161
----------
1162-
coef_ : array, shape (n_features,)
1162+
coef_ : array, shape (n_features, )
11631163
Weights asigned to the features.
11641164
1165-
intercept_ : array, shape (1,)
1165+
intercept_ : array, shape (1, )
11661166
The intercept term.
11671167
1168-
`average_coef_` : array, shape (n_features,)
1168+
`average_coef_` : array, shape (n_features, )
11691169
Averaged weights assigned to the features.
11701170
1171-
`average_intercept_` : array, shape (1)
1171+
`average_intercept_` : array, shape (1, )
11721172
The averaged intercept term.
11731173
11741174
Examples

0 commit comments

Comments
 (0)