Skip to content

Instantly share code, notes, and snippets.

View satishgunjal's full-sized avatar
💭
Analytics | CX Architect | Conversational AI | Chatbots | Machine Learning

Satish Gunjal satishgunjal

💭
Analytics | CX Architect | Conversational AI | Chatbots | Machine Learning
View GitHub Profile
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import os, datetime
@satishgunjal
satishgunjal / gist:eac71ed43c36a1fc5babcfac18155bf7
Created October 17, 2020 07:30
List all files under the input directory
# List all files under the input directory
for dirname, _, filenames in os.walk('/kaggle/input'):
for filename in filenames:
print(os.path.join(dirname, filename))
# List of physical devices
tf.config.experimental.list_physical_devices()
fashion_mnist = tf.keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
# Creating class label array
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
@satishgunjal
satishgunjal / gist:f58643f2bc8b2409d319dc87d189b2e6
Created October 17, 2020 07:35
Shape of training nad test data
# Shape of training nad test data
print(f'Shape of train_images: {train_images.shape}')
print(f'Shape of train_labels: {train_labels.shape}')
print(f'Shape of test_images: {test_images.shape}')
print(f'Shape of test_labels: {test_labels.shape}')
@satishgunjal
satishgunjal / gist:39408ecb37df68012c549ffdef65a073
Created October 17, 2020 07:36
There are 10 labels starting from 0 to 9
# There are 10 labels starting from 0 to 9
print(f'Unique train labels: {np.unique(train_labels)}')
print(f'Unique test labels: {np.unique(test_labels)}')
@satishgunjal
satishgunjal / gist:c00ed1100b90c089e54b0cbb3482bbc1
Created October 17, 2020 07:37
The images are 28x28 NumPy arrays, with pixel values ranging from 0 to 255
# The images are 28x28 NumPy arrays, with pixel values ranging from 0 to 255
train_images
plt.figure()
plt.imshow(train_images[0])
plt.colorbar()
plt.grid(False)
plt.show()
@satishgunjal
satishgunjal / gist:5e37c446c9ab6f6f35ee75bc10615618
Created October 17, 2020 07:39
Images labels(classes) possible values from 0 to 9
# Images labels(classes) possible values from 0 to 9
train_labels
@satishgunjal
satishgunjal / gist:230206da034e987299c1e879656d378c
Created October 17, 2020 07:40
Display the first 25 images from the training set and display the class name below each image.
# Display the first 25 images from the training set and display the class name below each image.
plt.figure(figsize=(10,10))
for i in range(25):
plt.subplot(5,5,i+1)
plt.xticks([])
plt.yticks([])
plt.grid(False)
plt.imshow(train_images[i], cmap=plt.cm.binary)
plt.xlabel(class_names[train_labels[i]])
plt.show()
train_images = train_images / 255.0
test_images = test_images / 255.0