Training a neural network classifier
Up to this point, we've loaded in the dataset and undertaken a basic exploratory data analysis. This section of the chapter will focus on training models through different configurations:
- Before we can move on to model training, we need to split our dataset into training and testing subsets. Doing so will allow us to have a sample of the data never seen by the model, and which can later be used for evaluation.
The following code snippet will split the data in a 75:25 ratio:
from sklearn.model_selection import train_test_split X = df.drop('target', axis=1) y = df['target'] X_train, X_test, y_train, y_test =train_test_split(\ X, y, test_size=0.25, random_state=42)
We can begin with training next.
- As always, let's start simply by training a baseline model. This will serve as a minimum viable performance that the neural network classifier has to outperform.
The simplest binary classification algorithm is logistic...