Skip to content

Commit d6f5b55

Browse files
committed
fixed code formatting #2
1 parent ff65305 commit d6f5b55

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

sklearn/linear_model/tests/test_sgd.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,8 +1713,9 @@ def test_sgd_oneclass_convergence():
17131713
# that the stopping criterion is working
17141714
for nu in [0.1, 0.5, 0.9]:
17151715
# no need for large max_iter
1716-
model = SGDOneClassSVM(nu=nu, max_iter=100, tol=1e-3,
1717-
learning_rate="constant", eta0=1e-3)
1716+
model = SGDOneClassSVM(
1717+
nu=nu, max_iter=100, tol=1e-3, learning_rate="constant", eta0=1e-3
1718+
)
17181719
model.fit(iris.data)
17191720
# 6 is the minimal number of iterations, after which optimization can stop
17201721
assert model.n_iter_ > 6
@@ -1724,9 +1725,10 @@ def test_sgd_oneclass_vs_linear_oneclass():
17241725
# Test convergence vs. liblinear OCSVM with kernel="linear"
17251726
for nu in [0.1, 0.5, 0.9]:
17261727
# allow enough iterations, small dataset
1727-
model = SGDOneClassSVM(nu=nu, max_iter=20000, tol=None,
1728-
learning_rate="constant", eta0=1e-3)
1729-
model_ref = OneClassSVM(kernel="linear", nu=nu, tol=1e-6) # reference model
1728+
model = SGDOneClassSVM(
1729+
nu=nu, max_iter=20000, tol=None, learning_rate="constant", eta0=1e-3
1730+
)
1731+
model_ref = OneClassSVM(kernel="linear", nu=nu, tol=1e-6) # reference model
17301732
model.fit(iris.data)
17311733
model_ref.fit(iris.data)
17321734

@@ -1740,8 +1742,8 @@ def test_sgd_oneclass_vs_linear_oneclass():
17401742
preds_corr = np.corrcoef(preds, preds_ref)[0, 1]
17411743
# check weights and intercept concatenated together for correlation
17421744
coef_corr = np.corrcoef(
1743-
np.concatenate([model.coef_, -model.offset_]),
1744-
np.concatenate([model_ref.coef_.flatten(), model_ref.intercept_])
1745+
np.concatenate([model.coef_, -model.offset_]),
1746+
np.concatenate([model_ref.coef_.flatten(), model_ref.intercept_]),
17451747
)[0, 1]
17461748
# share of predicted 1's
17471749
share_ones = (preds == 1).sum() / len(preds)
@@ -1750,7 +1752,7 @@ def test_sgd_oneclass_vs_linear_oneclass():
17501752
assert dec_fn_corr > 0.99
17511753
assert preds_corr > 0.95
17521754
assert coef_corr > 0.99
1753-
assert_allclose( 1 - share_ones, nu )
1755+
assert_allclose(1 - share_ones, nu)
17541756

17551757

17561758
def test_l1_ratio():

0 commit comments

Comments
 (0)