This is just a bonus step that you can perform to reduce overfitting. One way to reduce overfitting is via dropout regularization:
- To do that, let's import Dropout from the keras.layers library. This Dropout function periodically knocks out some of the neurons in the layer to make the other neurons pick up the slack. This is called a regularization technique because it's a way to regularize outputs that the neurons are making, and it'll help our network generalize slightly better.
- We'll define the dropout rate as 0.25 as we have only four neurons before testing starts. This will give us an even value that we can knock out each time. This is done by adding the following line to the model ...