# NOT RUN {
if(is_keras_available()){
mtcars$make <- unlist(lapply(strsplit(rownames(mtcars), " "), function(tokens) tokens[1]))
company <- kms(make ~ ., mtcars, Nepochs = 10)
# out of sample accuracy
pCorrect <- mean(company$y_test == company$predictions)
pCorrect
company$confusion
# plot(history$company) # helps pick Nepochs
company <- kms(make ~ ., mtcars, Nepochs = 3, seed = 2018,
layers = list(units = c(11, 9, NA), activation = c("relu", "relu", "softmax"),
dropout = c(0.4, 0.3, NA)))
}else{
cat("Please run install_keras() before using kms(). ?install_keras for options and details." )
}
# }
Run the code above in your browser using DataLab