File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
sklearn/linear_model/tests Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 8
8
from sklearn import preprocessing
9
9
from sklearn .linear_model import SGDClassifier , SGDRegressor
10
10
from sklearn .utils .testing import assert_greater , assert_less
11
+ from sklearn .base import clone
11
12
12
13
import unittest
13
14
from nose .tools import raises
@@ -152,6 +153,18 @@ def test_input_format(self):
152
153
Y_ = np .c_ [Y_ , Y_ ]
153
154
assert_raises (ValueError , clf .fit , X , Y_ )
154
155
156
+ def test_clone (self ):
157
+ """Test whether clone works ok. """
158
+ clf = self .factory (alpha = 0.01 , n_iter = 5 , penalty = 'l1' )
159
+ clf = clone (clf )
160
+ clf .set_params (penalty = 'l2' )
161
+ clf .fit (X , Y )
162
+
163
+ clf2 = self .factory (alpha = 0.01 , n_iter = 5 , penalty = 'l2' )
164
+ clf2 .fit (X , Y )
165
+
166
+ assert_array_equal (clf .coef_ , clf2 .coef_ )
167
+
155
168
156
169
class DenseSGDClassifierTestCase (unittest .TestCase , CommonTest ):
157
170
"""Test suite for the dense representation variant of SGD"""
You can’t perform that action at this time.
0 commit comments