7/28/2020

The airquality dataset

  • My app aims at exploring some more machine learning, at least conceptually.
  • Among the various stock datasets that R provides, there is one called airquality, containing some information about pollution.
  Ozone Solar.R Wind Temp Month Day
1    41     190  7.4   67     5   1
2    36     118  8.0   72     5   2
3    12     149 12.6   74     5   3
4    18     313 11.5   62     5   4
5    NA      NA 14.3   56     5   5
6    28      NA 14.9   66     5   6

The NA problem

  • The database, already small as it is, (153 observations of 6 variables), is even thinner if one excludes incomplete cases from the analysis.
  • I picked a small one because of the heaviness of the training step that comes within a machine learning algorithm.
  • The incomplete cases are overall the 27.5% of the total
  • They can be dealt it in two ways: either imputing them with the median or eliminating them altogether from the dataset. That’s what the “Impute NAs” checkbox is for.

Slide with R Output

The app also lets the user choose the data partition (in a limited range) with the “Training partition” slider; this will set how much of the data will be used for training.
The training takes place using a plain simple linear model. With a k-fold cross-validation training control system.

  • The app also lets the user choose how many (in a range 2 to 5) folds does he/she want to perform cross-validation with; that’s what the last input is for.

  • Please note that above all this, a preliminary analysis on the relevance of the 5 predictors has been made, and it turned out all predictors were somewhat relevant.

  • FINAL REMARK: this is NOT (nor it claims to be) a good exercise on machine learning. It was just something to recall a few concepts with, while experimenting a little with the tools of this course.

Example

Example with k = 3, p = 0.7 and NA imputing

Example with k = 3, p = 0.7 and NA imputing

THANK YOU!