|
6 | 6 | from numpy.testing import assert_equal |
7 | 7 | from nose.tools import assert_raises |
8 | 8 |
|
| 9 | +from sklearn.cross_validation import train_test_split |
9 | 10 | from sklearn.grid_search import GridSearchCV |
10 | 11 | from sklearn.ensemble import AdaBoostClassifier |
11 | 12 | from sklearn.ensemble import AdaBoostRegressor |
12 | | -from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor |
| 13 | +from scipy.sparse import csc_matrix |
| 14 | +from scipy.sparse import csr_matrix |
| 15 | +from scipy.sparse import coo_matrix |
| 16 | +from scipy.sparse import dok_matrix |
| 17 | +from scipy.sparse import lil_matrix |
13 | 18 | from sklearn.svm import SVC, SVR |
| 19 | +from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor |
14 | 20 | from sklearn.utils import shuffle |
15 | | -from sklearn.cross_validation import train_test_split |
16 | | -from scipy.sparse import csc_matrix, csr_matrix, coo_matrix, dok_matrix, \ |
17 | | - lil_matrix |
18 | 21 | from sklearn import datasets |
19 | 22 |
|
20 | 23 |
|
@@ -253,7 +256,10 @@ def fit(self, X, y, sample_weight=None): |
253 | 256 | self.data_type_ = type(X) |
254 | 257 | return self |
255 | 258 |
|
256 | | - X, y = datasets.make_classification() |
| 259 | + X, y = datasets.make_multilabel_classification(n_classes=1, |
| 260 | + return_indicator=True) |
| 261 | + # Flatten y to a 1d array |
| 262 | + y = np.ravel(y) |
257 | 263 |
|
258 | 264 | X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0) |
259 | 265 |
|
@@ -297,7 +303,9 @@ def fit(self, X, y, sample_weight=None): |
297 | 303 | self.data_type_ = type(X) |
298 | 304 | return self |
299 | 305 |
|
300 | | - X, y = datasets.make_regression() |
| 306 | + X, y = datasets.make_multilabel_classification(n_classes=20, |
| 307 | + return_indicator=True) |
| 308 | + y = y.sum(axis=1) |
301 | 309 |
|
302 | 310 | X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0) |
303 | 311 |
|
|
0 commit comments