Building neural networks for classification
In the previous examples, the final output could have been any given number, so we were dealing with regression. But in many cases, the final output may be 0 or 1, “yes” or “no,” or a range of distinct colors. In each of these cases, the type of machine learning algorithms that we are looking for fall under the general heading of classification.
In neural networks, one primary difference between regression and classification is the loss functions and scoring metrics. For classification, loss functions and scoring metrics are usually based on some kind of percentage of accuracy. It’s standard to use binary_crossentropy
as the loss function for classification and to include an accuracy
metric, which is the percentage of cases the model predicts correctly.
Another important difference when building a classification model is the final node itself. In regression, we used a Dense
layer with one node only...