Slides, code, cheat sheets, and RStudio lab notebooks for "Applied Machine Learning" course Spring 2018
- nyflights13
- new york city airport flight data from 2013 (must install)
- install with
install.packages("nyflights13", repos="http://cran.rstudio.com")
- iris
- classic iris flower data set from Fisher (comes with R installed)
- mtcars & mtcars2
- mtcars: USA motor trend cannonical data set (comes with R installed)
- mtcars2: An extension of mtcars by Max Kuhn with updated data and more features (see Labs/data/mtcars2.rda)
- Ames Data
- An extension of Ames, Iowa housing data set by Max Kuhn (must install)
- install with
install.packages("AmesHousing", repos="http://cran.rstudio.com")
- OkC
- predicting STEM and other for various predictors (see Labs/data/okc.rda)
- Contains several types of fields:
- a number of open text essays related to interests and personal descriptions
- single choice type fields, such as profession, diet, gender, body type, etc.
- multiple choice data, including languages spoken, etc.
- We will try to predict whether someone has a profession in the STEM fields (science, technology, engineering, and math) using a random sample of the overall dataset.
RStudio cheatsheets
- Fairly useful tool to preview HTML docs without having to clone the repository
- Right-click the *.html file, copy the link, then go here, paste the GitHub specific HTML link
- Always use a vectorized solution over iteration when possible, otherwise ... go to #2.
- Use a functional. Since R is a functional language and for readability, usually of the
apply()family, or a loop-wrapper function, unless ...- modifying in place: if you are modifying or transforming certain subsets (columns) of a data frame.
- recursive problems: whenever an iteration depends on the previous iteration, a loop is better suited because a functional does not have access to variables outside the present lexical scope.
- while loops: in problems where it is unknown how many iterations will be performed, while-loops are well suited and preferred over a functional.
- If you must use a loop, ensure the following:
- Initialize new objects: prior to the loop, allocate the necessary space ahead of time. Do NOT "grow" a vector on-the-fly within a loop (this is terribly slow).
- Optimize operations: do NOT perform operations inside the loop that could be done either up front of applied in a vectorized fashion following the loop. Enter the loop, do the bare minimum, then get out.
- Advanced R
- R Packages
- R for Data Science Book
- Twitter: @hadleywickham
- GitHub: https://github.com/hadley
- Applied Predictive Modeling Book
- Twitter: @topepo
- GitHub: https://github.com/topepo
The rsample package is smarter than you might think.
Information about the

