@@ -196,9 +196,11 @@ def test_linearsvr():
196
196
svr = svm .SVR (kernel = 'linear' , C = 1e3 ).fit (diabetes .data , diabetes .target )
197
197
score2 = svr .score (diabetes .data , diabetes .target )
198
198
199
- assert_allclose ( np .linalg .norm (lsvr .coef_ ) , np .linalg .norm (svr .coef_ ),1 , 0.0001 )
199
+ assert_allclose (np .linalg .norm (lsvr .coef_ ),
200
+ np .linalg .norm (svr .coef_ ), 1 , 0.0001 )
200
201
assert_almost_equal (score1 , score2 , 2 )
201
202
203
+
202
204
def test_linearsvr_fit_sampleweight ():
203
205
# check correct result when sample_weight is 1
204
206
# check that SVR(kernel='linear') and LinearSVC() give
@@ -213,7 +215,8 @@ def test_linearsvr_fit_sampleweight():
213
215
lsvr_no_weight = svm .LinearSVR (C = 1e3 ).fit (diabetes .data , diabetes .target )
214
216
score2 = lsvr_no_weight .score (diabetes .data , diabetes .target )
215
217
216
- assert_allclose (np .linalg .norm (lsvr .coef_ ), np .linalg .norm (lsvr_no_weight .coef_ ), 1 , 0.0001 )
218
+ assert_allclose (np .linalg .norm (lsvr .coef_ ),
219
+ np .linalg .norm (lsvr_no_weight .coef_ ), 1 , 0.0001 )
217
220
assert_almost_equal (score1 , score2 , 2 )
218
221
219
222
# check that fit(X) = fit([X1, X2, X3],sample_weight = [n1, n2, n3]) where
@@ -230,7 +233,8 @@ def test_linearsvr_fit_sampleweight():
230
233
lsvr_flat = svm .LinearSVR (C = 1e3 ).fit (X_flat , y_flat )
231
234
score4 = lsvr_flat .score (X_flat , y_flat )
232
235
233
- assert_almost_equal (score3 ,score4 ,2 )
236
+ assert_almost_equal (score3 , score4 , 2 )
237
+
234
238
235
239
def test_svr_errors ():
236
240
X = [[0.0 ], [1.0 ]]
0 commit comments