8000 EXA Use fetch_openml(returnX_y=True) (#11855) · scikit-learn/scikit-learn@4d7d410 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d7d410

Browse files
qinhanmin2014jnothman
authored andcommitted
EXA Use fetch_openml(returnX_y=True) (#11855)
1 parent 52a36b4 commit 4d7d410

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

examples/linear_model/plot_sparse_logistic_regression_mnist.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
train_samples = 5000
3737

3838
# Load data from https://www.openml.org/d/554
39-
mnist = fetch_openml('mnist_784', version=1)
40-
X = mnist.data
41-
y = mnist.target
39+
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
4240

4341
random_state = check_random_state(0)
4442
permutation = random_state.permutation(X.shape[0])

examples/multioutput/plot_classifier_chain_yeast.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@
4747
print(__doc__)
4848

4949
# Load a multi-label dataset from https://www.openml.org/d/40597
50-
yeast = fetch_openml('yeast', version=4)
51-
X = yeast.data
52-
Y = yeast.target == 'TRUE'
50+
X, Y = fetch_openml('yeast', version=4, return_X_y=True)
51+
Y = Y == 'TRUE'
5352
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=.2,
5453
random_state=0)
5554

examples/neural_networks/plot_mnist_filters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
print(__doc__)
2828

2929
# Load data from https://www.openml.org/d/554
30-
mnist = fetch_openml('mnist_784', version=1)
31-
X = mnist.data
32-
y = mnist.target
30+
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
3331

3432
# rescale the data, use the traditional train/test split
3533
X_train, X_test = X[:60000], X[60000:]

0 commit comments

Comments
 (0)
0