Path: blob/master/incubator/multiclass-classification-neural-network.ipynb
411 views
Introduction
I'd like to try doing multiclass classification with a deep neural network. The network architecture is a feed-forward network with one hidden layer in between the input and output; n_hidden
units is a hyperparameter.
Model Specification
Because neural networks are the highlight here, I will first do the model specification up-front.
Preprocess Data
Basic Cleaning
Now, let's read in the dataset. There's a bunch of preprocessing that has to happen. I happened to have this code written for the IACS 2017 data science bootcamp, and copied it over from there. It's commented out because it takes some time to execute, and if executed once, it needn't be executed again.
Let's now make the X and Y matrices. We use patsy to give us a quick and fast way to turn categorical variables into one-of-K columns.
Balance Classes
We will balance out the classes to make them evenly distributed.
Model Execution
We now make the model with {{n_hidden}} hidden units.
Results
Compared to the logistic regression notebook, we have higher performance!