Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Deep Learning with Keras

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 bewerken en uitvoeren