O'Reilly logo

R Deep Learning Projects by Pablo Maldonado, Yuxi Liu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

First solution – convolutional neural networks using MXNet

We start off with a solution similar to the one we developed at the end of the previous chapter, with CNNs using MXNet.

Again, we first split the dataset into two subsets for training (75%) and testing (25%) using the caret package:

> if (!require("caret"))  
+     install.packages("caret") 
> library (caret) 
> set.seed(42) 
> train_perc = 0.75 
> train_index <- createDataPartition(data.y, p=train_perc, list=FALSE) 
> train_index <- train_index[sample(nrow(train_index)),] 
> data_train.x <- data.x[train_index,] 
> data_train.y <- data.y[train_index] 
> data_test.x <- data.x[-train_index,] 
> data_test.y <- data.y[-train_index] 

Don't forget to specify a particular random seed for reproducible work. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required