Skip to Content
Advanced Machine Learning with R
book

Advanced Machine Learning with R

by Cory Lesmeister, Dr. Sunil Kumar Chinnamgari
May 2019
Intermediate to advanced
664 pages
15h 41m
English
Packt Publishing
Content preview from Advanced Machine Learning with R

Creating the model function

OK, we are going to create a model function, but not the model. The key function is keras_model_sequential(). There is a ton of stuff you can specify. What I'm going to show are two hidden layers with 64 neurons each. In both layers, the activation function is relu, which I covered earlier, and they work well for a regression problem. After the first layer, I demonstrate how to incorporate a dropout layer of 30%. Then, after the second hidden layer, I incorporate L1 regularization or LASSO, which we discussed in Chapter 4, Advanced Feature Selection in Linear Models. I thought it was important to show how to use both regularization methods, so you can use and adjust them as you deem fit.

The next function within ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning Using R

Machine Learning Using R

Karthik Ramasubramanian, Abhishek Singh
Machine Learning with R Cookbook - Second Edition

Machine Learning with R Cookbook - Second Edition

AshishSingh Bhatia, Yu-Wei, Chiu (David Chiu)
Practical Machine Learning in R

Practical Machine Learning in R

Fred Nwanganga, Mike Chapple

Publisher Resources

ISBN: 9781838641771Supplemental Content