|
3 | 3 |
|
4 | 4 | TODO: remove hard coded numerical results when possible
|
5 | 5 | """
|
| 6 | +import copy |
| 7 | +import warnings |
6 | 8 |
|
7 | 9 | import numpy as np
|
8 | 10 | from numpy.testing import assert_array_equal, assert_array_almost_equal, \
|
9 | 11 | assert_almost_equal
|
10 |
| -from nose.tools import assert_raises, assert_true |
| 12 | +from nose.tools import assert_raises, assert_true, assert_equal |
11 | 13 |
|
12 | 14 | from sklearn import svm, linear_model, datasets, metrics, base
|
13 | 15 | from sklearn.datasets.samples_generator import make_classification
|
@@ -151,7 +153,7 @@ def test_precomputed():
|
151 | 153 | assert_almost_equal(np.mean(pred == iris.target), .99, decimal=2)
|
152 | 154 |
|
153 | 155 |
|
154 |
| -def test_SVR(): |
| 156 | +def test_svr(): |
155 | 157 | """
|
156 | 158 | Test Support Vector Regression
|
157 | 159 | """
|
@@ -598,6 +600,15 @@ def test_linearsvc_verbose():
|
598 | 600 | os.dup2(stdout, 1) # restore original stdout
|
599 | 601 |
|
600 | 602 |
|
| 603 | +def test_linearsvc_deepcopy(): |
| 604 | + rng = check_random_state(0) |
| 605 | + clf = svm.LinearSVC() |
| 606 | + clf.fit(rng.rand(10, 2), rng.randint(0, 2, size=10)) |
| 607 | + with warnings.catch_warnings(record=True) as warn_queue: |
| 608 | + copy.deepcopy(clf).predict(rng.rand(2)) |
| 609 | + assert_equal(len(warn_queue), 1) |
| 610 | + |
| 611 | + |
601 | 612 | def test_svc_clone_with_callable_kernel():
|
602 | 613 | a = svm.SVC(kernel=lambda x, y: np.dot(x, y.T), probability=True)
|
603 | 614 | b = base.clone(a)
|
|
0 commit comments