LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Introduction to TensorFlow in Python

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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=____)
Code bearbeiten und ausführen