-
-
Save BinarySpoon/886d2c633c1d72a4485839c3f621d78f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing Data --> | |
digits = load_digits() | |
# Display Number Of Images --> | |
print("Image data shape: ", digits.data.shape) | |
print() | |
print("Label data shape: ", digits.target.shape) | |
# Show images --> | |
plt.figure(figsize=(20,8)) | |
for index, (image, label) in enumerate(zip(digits.data[0:16], digits.target[0:16])): | |
plt.subplot(2,8, index+1) | |
plt.imshow(np.reshape(image,(8,8)), cmap=plt.cm.gray) | |
plt.title('Labeled %i\n' % label, fontsize = 20) | |
''' | |
1. create a blank fig. | |
2. run a loop calling the first 16 entries in digits.data, digits.target as "image" and "label" respectively. | |
3. create a subplot inside the blank figure of 2 rows and 8 cols. | |
4. place images in them (8,8) long and gray. | |
Algo credit: 'https://towardsdatascience.com/logistic-regression-using-python-sklearn-numpy-mnist-handwriting-recognition-matplotlib-a6b31e2b166a' | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment