This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ===================================================================================================================== | |
| # OUTLIERS | |
| # ===================================================================================================================== | |
| library(dplyr) | |
| library(corrgram) | |
| # Focus our attention on a subset of the baseball data. | |
| # | |
| baseball = select(baseball, Name, Atbatc:Walksc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ===================================================================================================================== | |
| # TRANSFORMATIONS | |
| # ===================================================================================================================== | |
| # Focus our attention on a subset of the baseball data. | |
| # | |
| baseball = select(baseball, Name, Atbatc:Walksc) | |
| # Box plots. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ===================================================================================================================== | |
| # TRANSFORMATIONS | |
| # ===================================================================================================================== | |
| # Focus our attention on a subset of the baseball data. | |
| # | |
| baseball = select(baseball, Name, Atbatc:Walksc) | |
| # Box plots. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ===================================================================================================================== | |
| # OUTLIERS | |
| # ===================================================================================================================== | |
| library(dplyr) | |
| library(corrgram) | |
| # Focus our attention on a subset of the baseball data. | |
| # | |
| baseball = select(baseball, Name, Atbatc:Walksc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################## | |
| # DAY 11: LINEAR REGRESSION EXERCISES | |
| ############################################################## | |
| # 1) Height and Mass. Scrape the height and mass data from here. | |
| # ---------------------------------------------------------------------------- | |
| library(rvest) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################## | |
| # DAY 11: LINEAR REGRESSION EXERCISES | |
| ############################################################## | |
| # 1) Height and Mass. Scrape the height and mass data from here. | |
| # ---------------------------------------------------------------------------- | |
| library(rvest) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ------------------------------------------------------------------ | |
| # EXERCISE 3 | |
| # Use the birthwt data in the MASS package to construct a model for low birth | |
| # weight. Are there any features which should be excluded from the model? | |
| # ------------------------------------------------------------------ | |
| library(MASS) | |
| library(caret) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ------------------------------------------------------------------ | |
| # DAY 12 EXERCISES - LOGISTIC REGRESSION | |
| # ------------------------------------------------------------------ | |
| # ------------------------------------------------------------------ | |
| # EXERCISE 1 | |
| # Create a parsimonious model for the myopia data. Does its performance differ | |
| # substantially from the full model? | |
| # ------------------------------------------------------------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ------------------------------------------------------------------ | |
| # DAY 12 EXERCISES - DECISION TREES | |
| # ------------------------------------------------------------------ | |
| # ------------------------------------------------------------------ | |
| # EXERCISE 1 | |
| # Complete the iris modelling exercise. This is a multiclass problem. Some models | |
| # support multiclass problems, others don’t. Decision trees do. Divide the data | |
| # in a 60% training and 40% testing split. Create a model based on the training | |
| # data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sample.data <- read.csv("svm_sample.csv") | |
| sample.data <- sample.data[,-1] #getting rid of id variables | |
| library(caret) | |
| train_index <- createDataPartition(sample.data$color, 0.8)[[1]] | |
| sample.data.train <- sample.data[train_index,] | |
| sample.data.test <- sample.data[-train_index,] |