An irrigation machine
You're going to automate the watering of farm parcels by making an intelligent irrigation machine. Multi-label classification problems differ from multi-class problems in that each observation can be labeled with zero or more classes. So classes/labels are not mutually exclusive, you could water all, none or any combination of farm parcels based on the inputs.
To account for this behavior what we do is have an output layer with as many neurons as classes but this time, unlike in multi-class problems, each output neuron has a sigmoid
activation function. This makes each neuron in the output layer able to output a number between 0 and 1 independently.
The Sequential()
model and Dense()
layers are ready to be used. It's time to build an intelligent irrigation machine!

This exercise is part of the course
Introduction to Deep Learning with Keras
Exercise instructions
- Instantiate a
Sequential()
model. - Add a hidden layer of 64 neurons with as many input neurons as there are sensors and
relu
activation. - Add an output layer with as many neurons as parcels and
sigmoid
activation. - Compile your model with the
adam
optimizer andbinary_crossentropy
loss.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Instantiate a Sequential model
model = ____
# Add a hidden layer of 64 neurons and a 20 neuron's input
____
# Add an output layer of 3 neurons with sigmoid activation
____
# Compile your model with binary crossentropy loss
model.compile(optimizer='adam',
loss = ____,
metrics=['accuracy'])
model.summary()