** Resolve errors in the fetch_mldata function (sklearn.datasets.fetch_mldata) used when downloading datasets with scikit-learn (sklearn). ** **
sklearn(scikit-learn):version 0.21.2
Use fetch_openml because fetch_mldata has been deprecated and fetch_openml was created instead.
Note that fetch_mldata will be deleted in version 0.22.
sklearn.datasets.fetch_mldata to be removed in version 0.22.
scikit-learn can download various datasets, but here is an example of downloading the mnist dataset. Also, the language is Python.
fetch_mldata.py
from sklearn.datasets import fetch_mldata
mnist = fetch_mldata("MNIST original", data_home=".")
x_all = mnist['data'].astype(np.float32) / 255
y_all = mnist['target'].astype(np.int32)
Please note that fetch_openml may be different from the dataset name used in fetch_mldata.
fetch_openml.py
from sklearn.datasets import fetch_openml
mnist_X, mnist_y = fetch_openml('mnist_784', version=1, data_home=".", return_X_y=True)
x_all = mnist_X.astype(np.float32) / 255
y_all = mnist_y.astype(np.int32)