IniziaInizia gratis

Training with Keras

In this exercise, we return to our sign language letter classification problem. We have 2000 images of four letters--A, B, C, and D--and we want to classify them with a high level of accuracy. We will complete all parts of the problem, including the model definition, compilation, and training.

Note that keras has been imported from tensorflow for you. Additionally, the features are available as sign_language_features and the targets are available as sign_language_labels.

Questo esercizio fa parte del corso

Introduction to TensorFlow in Python

Visualizza il corso

Istruzioni dell'esercizio

  • Define a sequential model named model.
  • Set the output layer to be dense, have 4 nodes, and use a softmax activation function.
  • Compile the model with the SGD optimizer and categorical_crossentropy loss.
  • Complete the fitting operation and set the number of epochs to 5.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Define a sequential model
____

# Define a hidden layer
model.add(keras.layers.Dense(16, activation='relu', input_shape=(784,)))

# Define the output layer
____

# Compile the model
model.compile('____', loss='____')

# Complete the fitting operation
model.fit(____, ____, epochs=____)
Modifica ed esegui il codice