Free Master of Data Science Machine Learning Questions and Answers — Questions and Answers
Question 1: Which of the following can be used to a collection of data to produce balanced cross-validation groupings?
- createSample
- createResample
- createFolds (Correct answer)
- None of the above
Correct answer: createFolds
In R's `caret` package, the `createFolds` function is specifically designed to generate balanced cross-validation folds. It partitions the data into `k` folds, ensuring that the class distribution (for classification problems) is approximately maintained within each fold, which is crucial for robust model evaluation. This helps prevent bias in the training and testing sets.
Question 2: Identify the incorrect statement.
- Three parameters are used for time series splitting
- Horizon parameter is the number of consecutive values in test set sample
- Simple random sampling of time series is probably the best way to resample times series data. (Correct answer)
- All of the above
Correct answer: Simple random sampling of time series is probably the best way to resample times series data.
Simple random sampling is generally inappropriate for time series data because it disrupts the inherent temporal dependencies and autocorrelation. Time series data has a sequential order, and random sampling would destroy this structure, leading to invalid models and predictions. Resampling methods for time series must preserve the chronological order.
Question 3: Which of the subsequent functions can be used to maximize the minimal differences?
- avgDiss
- minDiss
- sumDiss (Correct answer)
- All of the above
Correct answer: sumDiss
In the context of selecting diverse samples, particularly with functions like `maxDissim` in R's `caret` package, `sumDiss` refers to maximizing the sum of dissimilarities between selected samples and a reference set. This approach aims to ensure that the chosen samples are as different from each other as possible, thereby maximizing the minimal differences and promoting diversity within the subset.
Question 4: Which of the following functions is capable of producing the indices needed for the time series splitting type?
- binTimeSlices
- newTimeSlices
- createTimeSlices (Correct answer)
- None of the above
Correct answer: createTimeSlices
In R's `caret` package, the `createTimeSlices` function is specifically designed to generate indices for time series cross-validation. It creates training and testing sets that respect the temporal order of the data, which is essential for accurate evaluation of models on time series. This function ensures that the test set always follows the training set chronologically.
Question 5: Which of the aforementioned functions wraps various lattice graphs to display the data?
- plotsample
- featurePlot (Correct answer)
- levelplot
- None of the above
Correct answer: featurePlot
The `featurePlot` function in R's `caret` package is a versatile tool for visualizing relationships between features (predictor variables) and the outcome variable. It wraps various `lattice` graphics functions to create different types of plots, such as scatter plots, box plots, and density plots, allowing for comprehensive exploration of data characteristics and relationships. It simplifies the process of generating informative visualizations.
Question 6: Identify the incorrect statement.
- Predictors might have only a handful of unique values that occur with very low frequencies
- The function findLinearCombos uses the QR decomposition of a matrix to enumerate sets of linear combinations
- In every situation, the data generating mechanism can create predictors that only have a single unique value (Correct answer)
- All of the above
Correct answer: In every situation, the data generating mechanism can create predictors that only have a single unique value
This statement is incorrect because a predictor with only a single unique value is a constant, providing no variance or information to distinguish between outcomes. Such a predictor is useless for most predictive modeling tasks, so a data generating mechanism aiming for informative predictors would not typically create one that is entirely constant across all observations.
Question 7: The evimp function in the ______ package is wrapped in varImp.
- plot
- numpy
- earth (Correct answer)
- None of the above
Correct answer: earth
The `evimp` function is specifically used to calculate variable importance for models generated by the `earth` package, which implements Multivariate Adaptive Regression Splines (MARS). The `varImp` function in the `caret` package provides a unified interface for variable importance across various models, and it wraps `evimp` when dealing with `earth` models.
Question 8: Identify the incorrect statement.
- An argument, para, is used to pick the model fitting technique (Correct answer)
- The trapezoidal rule is used to compute the area under the ROC curve
- For regression, the relationship between each predictor and the outcome is evaluated
- All of the above
Correct answer: An argument, para, is used to pick the model fitting technique
This statement is incorrect because the argument typically used to specify the model fitting technique in many machine learning frameworks, such as R's `caret` package, is `method`. The term `para` is not a standard or commonly recognized argument for this purpose. Therefore, stating `para` is used to pick the model fitting technique is inaccurate.
Question 9: Identify the incorrect statement.
- In Sample Error is also called resubstitution error
- In Sample Error is also called generalization error (Correct answer)
- Out of Sample Error is the error rate you get on the new dataset
- All of the above
Correct answer: In Sample Error is also called generalization error
This statement is incorrect because In-Sample Error (also known as resubstitution error) refers to the error rate calculated on the training data. Generalization error, on the other hand, is synonymous with Out-of-Sample Error, which measures a model's performance on new, unseen data. These are distinct concepts in model evaluation.
Question 10: Which of the following best describes the proper working order?
- evaluation->input data ->algorithms
- questions->evaluation ->algorithms
- questions->input data ->algorithms (Correct answer)
- All of the above
Correct answer: questions->input data ->algorithms
A data science project properly begins by defining the `questions` to be answered, as this guides the entire process. Next, relevant `input data` is collected and prepared to address these questions. Finally, appropriate `algorithms` are selected and applied to the data to build models and derive insights that answer the initial questions.
Question 11: Which of the following exhibits the proper relative importance?
- question->data->features->algorithms (Correct answer)
- algorithms->data->features->question
- question->features->data->algorithms
- None of the above
Correct answer: question->data->features->algorithms
This order reflects the hierarchical importance in a data science project. A clear `question` is paramount to define the project's goal. High-quality `data` is fundamental, as models are only as good as the data they learn from. Well-engineered `features` (derived from data) are crucial for model performance, and finally, `algorithms` are the tools applied to these features to answer the question.
Question 12: When making predictions, trees examine each set of data's .
- heterogeneity
- equality
- homogeneity (Correct answer)
- All of the above
Correct answer: homogeneity
Decision trees operate by recursively partitioning the data into subsets that are as `homogeneous` as possible with respect to the outcome variable. At each split, the goal is to create child nodes where the data points within each node are highly similar, leading to more accurate and consistent predictions within those segments.
Question 13: Identify the incorrect statement.
- Test transformation would mostly be imperfect
- The first goal is statistical and second is data compression in PCA
- Training and testing data must be processed in different way (Correct answer)
- All of the above
Correct answer: Training and testing data must be processed in different way
This statement is incorrect because training and testing data must be processed in the *same* way to ensure consistency and prevent data leakage. For example, if data is scaled or imputed, the parameters (e.g., mean, standard deviation) derived from the training data must be applied to the test data. Processing them differently would lead to inconsistent feature representations and unreliable model evaluation.
Question 14: Which of the following options for a bagging method does the train function offer?
- bagFDA
- treebag
- bagEarth
- All of the above (Correct answer)
Correct answer: All of the above
The `train` function in the `caret` package is a versatile interface for training various machine learning models, including several bagging methods. It supports `bagFDA` (Bagged Flexible Discriminant Analysis), `treebag` (Bagged Classification and Regression Trees), and `bagEarth` (Bagged Multivariate Adaptive Regression Splines). Therefore, all the listed options are available bagging methods within the `train` function.
Question 15: Which of the following statements about random forest is accurate?
- Random forest are difficult to interpret but very less accurate
- Random forest are easy to interpret but often very accurate
- Random forest are difficult to interpret but often very accurate (Correct answer)
- None of the above
Correct answer: Random forest are difficult to interpret but often very accurate
Random Forests are ensemble learning methods known for their high predictive accuracy and robustness, making them very accurate. However, due to their complex structure, which involves aggregating predictions from many individual decision trees, they are generally considered 'black box' models and are `difficult to interpret` compared to simpler models.
Question 16: Which of the following uses additive logistic regression as the foundation for statistical boosting?
- mboost
- ada
- gbm
- gamBoost (Correct answer)
Correct answer: gamBoost
The `gamBoost` function is specifically designed for generalized additive models (GAMs) and utilizes boosting techniques. It builds upon the principles of additive logistic regression, iteratively fitting simple models to residuals to improve overall prediction, making it the correct option among those listed for statistical boosting based on this foundation.
Which of the following can be used to a collection of data to produce balanced cross-validation groupings?