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

The autoencoder approach – Keras

OK, time to get into Keras. We should leave apart a small fraction of the data to use as a validation or test set, and develop the model on the remaining. There is no golden standard as to how this should be done. For this example, we will use a 10% test set and a 90% training set:

# Remove the time and class columnidxs <- sample(nrow(df), size=0.1*nrow(df))train <- df[-idxs,]test <- df[idxs,]y_train <- train$Classy_test <- test$ClassX_train <- train %>% select(-one_of(c("Time","Class")))X_test <- test %>% select(-one_of(c("Time","Class")))# Coerce the data frame to matrix to perform the trainingX_train <- as.matrix(X_train)X_test <- as.matrix(X_test)

Notice that we also excluded the Class and Time columns. ...

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