from sklearn.datasets import fetch_mldata-> fetch_openml

background

An event that occurred when I was trying to cluster with t-SNE and was fishing various sample codes I was coding with reference to this

Location of occurrence

Part 1

import matplotlib.pyplot as plt
from mpl.toolkits.mplot3d import Axes3D
import seaborn as sns
from __future__ import print_function
from sklearn.datasets import fetch_openml # <-here
from sklearn.decompositon import PCA
from sklearn.manifold import TSNE

%matplotlib inline

Part 2

mnist = fetch_mldata("MNIST original") # <-here
X = mnist.data / 255.0
y = mnist.target
print(X.shape, y.shape)

Correction code

Part 1

import matplotlib.pyplot as plt
from mpl.toolkits.mplot3d import Axes3D
import seaborn as sns
from __future__ import print_function
from sklearn.datasets import fetch_openml # <-here
from sklearn.decompositon import PCA
from sklearn.manifold import TSNE

%matplotlib inline

Part 2

mnist = fetch_openml('mnist_784', version=1,) # <-here
X = mnist.data / 255.0
y = mnist.target

print(X.shape, y.shape)

Cause

It seems that the cause is that https://openml.org, which is the reference destination of fetch_mldata, is down.

reference

Recommended Posts

from sklearn.datasets import fetch_mldata-> fetch_openml
Python from or import
From sys import stderr or import sys → sys.stderr
Django: Import a class from a string
python> link> from __future__ import absolute_import