Extracting one sample each of digits 0-9

To get a feel for what the images look like, we want to extract one image of each digit for inspection. For this, we need to find out where the digits are. We can do so by tracking down the right indices (the data labels) with digits.target then we write a few lines of code to call 10 images:

indices = []
for i in range(10):
for j in digits.target:
if i==j:
indices.append(j)
break
print(indices)

Interestingly, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] is returned as output, which means the first 10 samples happen to be in numerical order. Is it by chance or is the data ordered? We need to check as the sample distribution can impact our training performance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.249.48