Predicting glass type revisited
In Chapter 3, Linear Regression, we analyzed the glass identification dataset, whose task is to identify the type of glass comprising a glass fragment found at a crime scene. The output of this dataset is a factor with several class levels corresponding to different types of glass. Our previous approach was to build a one-versus-all model using multinomial logistic regression. The results were not very promising, and one of the main points of concern was a poor model fit on the training data.
In this section, we will revisit this dataset and see whether a neural network model can do better. At the same time, we will demonstrate how neural networks can handle classification problems as well:
> glass <- read.csv("glass.data", header = FALSE) > names(glass) <- c("id", "RI", "Na", "Mg", "Al", "Si", "K", "Ca", "Ba", "Fe", "Type") > glass$id <- NULL
Our output is a multiclass factor and so we will want to dummy-encode this into binary columns. With...