pull down to refresh
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
mnist = keras.datasets.mnist
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
train_images = train_images / 255.0
test_images = test_images / 255.0
model = keras.Sequential([
layers.Flatten(input_shape=(28, 28)),
layers.Dense(128, activation='relu'),
layers.Dropout(0.2),
layers.Dense(10)
])
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer='adam',
loss=loss_fn,
metrics=['accuracy'])
model.fit(train_images, train_labels, epochs=5)
test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2)
print(f'\n: {test_acc*100:.2f}%')
reply
10 sats \ 0 replies \ @Ksjznxnxkxksn 3 Oct 2023
Welcome!
reply
0 sats \ 0 replies \ @nym 19 Nov 2023
Welcome aboard!
reply
0 sats \ 0 replies \ @faradayfedora 3 Oct 2023
Welcome
reply