Neural networks in regression versus classification
If you've done any machine learning with scikit-learn, you know there are dedicated classes and models for regression and classification datasets. For example, if you would like to apply a decision tree algorithm to a classification dataset, you would use the DecisionTreeClassifier
class. Likewise, you would use the DecisionTreeRegressor
class for regression tasks.
But what do you do with neural networks? There are no dedicated classes or layers for classification and regression tasks.
Instead, you can accommodate by tweaking the number of neurons in the output layer. Put simply, if you're dealing with regression tasks, there has to be a single neuron in the output layer. If you're dealing with classification tasks, there will be as many neurons in the output layer as there are distinct classes in your target variable.
For example, you saw how the neural network in the previous section had 10 neurons in the...