Question: Python code for the commented steps please The first thing that you should know of an array is its shape. That is, the number of

Python code for the commented steps please The first thing that youshould know of an array is its shape. That is, the numberPython code for the commented steps please

The first thing that you should know of an array is its shape. That is, the number of dimensions and items that is contained within an array. The array's shape is a tuple of integers that specify the sizes of each dimension. In other words, if you have a 3d array like this y=np.zeros((2,3,4)), the shape of your array will be (2,3,4). Now let's try to see what the shape is of these three arrays that you have distinguished (the data, target and DESCR arrays). Use first the data attribute to isolate the numpy array from the digits data and then use the shape attribute to find out more. You can do the same for the target and DESCR. Again, we will deal with the images attribute later. [ ] 1 \# import 'numpy' as 'np' 2 import numpy as np 3 4 \# Isolate the 'digits'data 5 digits_data = digits.data 6 7 \# Inspect the shape 8 print('data dimensions: ', digits_data.shape) 9 10 \# Isolate the target values with 'target' 11 digits_target = digits.target 12 13 \# Inspect the shape 14 print('target dimensions: ', digits_target.shape) 15 16 \# Print the number of unique labels 17 number_digits = len(np.unique(digits.target)) 18 19 \# Isolate the 'images' 20 digits_images = digits.images 21 22 \# Inspect the shape 23 print('image dimensions: ' digits_images.shape)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!