EXA Use fetch_openml(returnX_y=True) (#11855)

This commit is contained in:
Hanmin Qin 2018-08-20 07:02:52 +08:00 committed by Joel Nothman
parent 52a36b4d1a
commit 4d7d410ed2
3 changed files with 4 additions and 9 deletions

View File

@ -36,9 +36,7 @@ t0 = time.time()
train_samples = 5000
# Load data from https://www.openml.org/d/554
mnist = fetch_openml('mnist_784', version=1)
X = mnist.data
y = mnist.target
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
random_state = check_random_state(0)
permutation = random_state.permutation(X.shape[0])

View File

@ -47,9 +47,8 @@ from sklearn.linear_model import LogisticRegression
print(__doc__)
# Load a multi-label dataset from https://www.openml.org/d/40597
yeast = fetch_openml('yeast', version=4)
X = yeast.data
Y = yeast.target == 'TRUE'
X, Y = fetch_openml('yeast', version=4, return_X_y=True)
Y = Y == 'TRUE'
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=.2,
random_state=0)

View File

@ -27,9 +27,7 @@ from sklearn.neural_network import MLPClassifier
print(__doc__)
# Load data from https://www.openml.org/d/554
mnist = fetch_openml('mnist_784', version=1)
X = mnist.data
y = mnist.target
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
# rescale the data, use the traditional train/test split
X_train, X_test = X[:60000], X[60000:]