Q1. Say, you are interested in predicting body mass index (bmi in kg/m2) with the following outcome model: model <- as.formula(paste('bmi ~ age + sex + race + income + diet + smoking')). The name of the analytic, training, and testing datasets are data.analytic, data.train, and data.test, respectively. Which function can be used to fit 10-fold cross-validation in R?
- A. fit <- predict(lm(model, data = data.train), newdata = data.test)
- B. fit <- caret::train(model, trControl = trainControl(method = 'cv', number = 10), data = data.train, method = 'lm')
- C. fit <- caret::train(model, trControl = trainControl(method = 'cv', number = 10), data = data.analytic, method = 'lm')
- D. fit <- caret::train(model, trControl = trainControl(method = 'cv', number = 10), data = data.test, method = 'lm
Q2. Say, 'bmi' is a binary variable in Q1, defined as bmi > 30kg/m2 or not. Which function would you likely use to fit 10-fold cross-validation?
- A. fit <- predict(glm(model, data = data.train, family = 'binomial'), newdata = data.test)
- B. fit <- caret::train(model, trControl = trainControl(method = 'cv', number = 10), data = data.train, method = 'glm')
- C. fit <- caret::train(model, trControl = trainControl(method = 'cv', number = 10, classProbs = TRUE, summaryFunction = twoClassSummary), data = data.analytic, method = 'glm')
- D. fit <- caret::train(model, trControl = trainControl(method = 'cv', number = 10), data = data.analytic, method = 'glm)
Q5. Which is an example of unsupervised learning? (Select All that apply)
- A. fit.unsupervised <- caret::train(model, trControl = trainControl(method = 'cv', number = 10, classProbs = TRUE, summaryFunction = twoClassSummary), data = data.analytic, method = 'rpart', verbose = FALSE, metric = 'ROC')
- B. fit.unsupervised <- varclus(model, data = data.analytic)
- C. fit.unsupervised <- kmeans(data.analytic, centers = 2)
- D. fit.unsupervised <- glm(model, data = data.analytic, family = binomial)
See the difference between supervised and unsupervised learning. Also, select all that apply.