LoslegenKostenlos starten

A multi-class model

You're going to build a model that predicts who threw which dart only based on where that dart landed! (That is the dart's x and y coordinates on the board.)

This problem is a multi-class classification problem since each dart can only be thrown by one of 4 competitors. So classes/labels are mutually exclusive, and therefore we can build a neuron with as many output as competitors and use the softmax activation function to achieve a total sum of probabilities of 1 over all competitors.

The Sequential model and Dense layers are already imported for you to use.

Diese Übung ist Teil des Kurses

<Kurs>Introduction to Deep Learning with Keras</Kurs>
Kurs ansehen

Übungsanweisungen

  • Instantiate a Sequential model.
  • Add 3 dense layers of 128, 64 and 32 neurons each.
  • Add a final dense layer with as many neurons as competitors.
  • Compile your model using categorical_crossentropy loss.

Interaktive praktische Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Instantiate a sequential model
model = ____
  
# Add 3 dense layers of 128, 64 and 32 neurons each
model.add(____(____, input_shape=(2,), activation='relu'))
model.add(____(____, activation='relu'))
model.add(____(____, activation='relu'))
  
# Add a dense layer with as many neurons as competitors
model.add(____(____, activation=____))
  
# Compile your model using categorical_crossentropy loss
model.compile(loss=____,
              optimizer='adam',
              metrics=['accuracy'])
Code bearbeiten und ausführen