Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Dataset Import | Recognizing Handwritten Digits
Recognizing Handwritten Digits

book
Dataset Import

Begin by importing the necessary data for your upcoming analysis.

Utilize the fetch_openml function from the sklearn.datasets module, a component of the widely used scikit-learn library for machine learning in Python, to access and retrieve datasets from the OpenML repository. Specifically, for this task, it's employed to acquire the MNIST dataset, a renowned collection of handwritten digits frequently employed in image classification challenges.

Task

Swipe to start coding

You are required to import the MNIST dataset ("mnist_784"), a popular dataset used for training image processing systems, into your Python environment using the fetch_openml function from the sklearn.datasets module.

Solution

# Import the fetch_openml function from sklearn.datasets to access open datasets
from sklearn.datasets import fetch_openml

# Fetch the MNIST dataset
mnist = fetch_openml("mnist_784", version=1, as_frame=False, parser='auto')

# Convert the target labels from strings to integers
mnist.target = mnist.target.astype(int)

Mark tasks as Completed
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
AVAILABLE TO ULTIMATE ONLY
some-alt