Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python code please with the steps from comments [6] 1 # Import the pandas library as pd 2 import pandas as pd 3 4 #

image text in transcribed

python code please with the steps from comments

[6] 1 \# Import the "pandas" library as "pd" 2 import pandas as pd 3 4 \# Load in the data with "read_csv()" 5 digits = pd.read_csv("http://archive.ics.uci.edu/ml/machine-learning-databases/optdigits/optdigits.tra", header=None) 6 7 \# since 'digits' is now a dataframe (without the meta data), we can just look at the first five rows using .head() 8 Note that if you download the data like this, the data is already split up in a training and a test set, indicated by the extensions .tra and .tes. You'll need to load in both files to elaborate your project. With the command above, you only load in the training set. Please write your own code below to download the test set. [7] 1 \# test set URL: http://archive.ics.uci.edu/ml/machine-learning-databases/optdigits/optdigits.tes 2 \# use "read_csv()" again, and name the dataframe as "digits_test" 3 4 5 \# you can check the first 5 rows of 'digit_test' to make sure you have downloaded in correctly 6 With the help of scikit-learn, you do not have to download any data since the DIGITS dataset is pre-loaded in it. You can just load it from scikit-learn. Fun fact: did you know the name originates from the fact that this library is a scientific toolbox built around SciPy? By the way, there is more than just one scikit out there. This scikit contains modules specifically for machine learning and data mining, which explains the second component of the library name. :) To load in the data, you import the module datasets from sklearn. Then, you can use the load_digits () method from datasets to load in the data: [8] 1 \# Import "datasets' from "sklearn" 2 4 \# Load in the 'digits' data using load_digits() as 'digits' 5 6 7 \# Print the "digits' data 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions