Neural networks
We can model the housing data as a neural network where the different data elements are inputs into the system and the output of the network is the house price. With a neural net we end up with a graphical model that provides the factors to apply to each input in order to arrive at our housing price.
Neural networks in R
There is a neural network package available in R. We load that in:
#install.packages('neuralnet', repos="http://cran.r-project.org")
library("neuralnet")
Load in the housing data:
filename = "http://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data"
housing <- read.table(filename)
colnames(housing) <- c("CRIM", "ZN", "INDUS", "CHAS", "NOX",
"RM", "AGE", "DIS", "RAD", "TAX", "PRATIO",
"B", "LSTAT", "MDEV")
Split up the housing data into training and test sets (we have seen this coding in prior examples):
housing <- housing[order(housing$MDEV),]
#install.packages("caret")
library(caret...