DOC Replace image vectorization with built-in fields
@@ -23,13 +23,7 @@ from sklearn.metrics import classification_report
from sklearn.svm import SVC
# Loading the Digits dataset
-digits = datasets.load_digits()
-
-# To apply an classifier on this data, we need to flatten the image, to
-# turn the data in a (samples, feature) matrix:
-n_samples = len(digits.images)
-X = digits.images.reshape((n_samples, -1))
-y = digits.target
+X, y = datasets.load_digits(return_X_y=True)
# Split the dataset in two equal parts
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0)
