A binary classification model
Now that you know what the Banknote Authentication dataset looks like, we'll build a simple model to distinguish between real and fake bills.
You will perform binary classification by using a single neuron as an output. The input layer will have 4 neurons since we have 4 features in our dataset. The model's output will be a value constrained between 0 and 1.
We will interpret this output number as the probability of our input variables coming from a fake dollar bill, with 1 meaning we are certain it's a fake bill.
This exercise is part of the course
Introduction to Deep Learning with Keras
Exercise instructions
- Import the
Sequential
model andDense
layer from tensorflow.keras. - Create a sequential model.
- Add a 4 neuron input layer with the
input_shape
parameter and a 1 neuron output layer withsigmoid
activation. - Compile your model using
sgd
as an optimizer.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the sequential model and dense layer
from tensorflow.keras.____ import ____
from tensorflow.keras.____ import ____
# Create a sequential model
model = ____
# Add a dense layer
model.____(Dense(____, input_shape=(____,), activation=____))
# Compile your model
model.____(loss='binary_crossentropy', optimizer=____, metrics=['accuracy'])
# Display a summary of your model
model.summary()