Supervised Machine Learning
- 91Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is supervised machine learning?
91 questions
- 1
What is supervised machine learning?
Model answer
Supervised machine learning uses a data set of features, X, to predict or identify an association with a known response, y.
Explanation
The response variable provides the outcome that the model learns to predict from the features.
- 2
How does unsupervised learning differ from supervised learning?
Model answer
Unsupervised learning seeks to discover structure or signal in a feature matrix, X, when no response variable, y, is available.
Explanation
Supervised learning predicts a response, whereas unsupervised learning explores the data without a response to predict.
- 3
What are the two main forms of supervised learning?
Model answer
The two main forms are regression, which predicts quantitative responses, and classification, which predicts categorical responses.
Explanation
The type of response variable determines whether the problem is regression or classification.
- 4
Give three examples of quantitative responses suitable for regression.
Model answer
Examples include blood pressure, cholesterol level, and tumor size.
Explanation
Each of these outcomes is measured numerically.
- 5
Give three examples of categorical responses suitable for classification.
Model answer
Examples include tumor versus normal tissue, heart disease versus no heart disease, and disease subtype.
Explanation
These outcomes consist of categories rather than numerical measurements.
- 6
Does the type of feature matrix, X, determine whether a problem is regression or classification?
Model answer
No. The response determines the framework: a quantitative response implies regression, while a categorical response implies classification, regardless of whether the features are quantitative or categorical.
Explanation
The predictor data type does not determine the distinction between regression and classification.
- 7
What type of supervised learning problem involves a possibly censored survival time?
Model answer
Survival analysis is a distinct form of supervised learning used when the response is a survival time that may be censored because subjects die or leave the study.
Explanation
Censoring occurs when the exact event time is not observed for every subject.
- 8
How do the main ideas of regression extend to other quantitative-response problems?
Model answer
The main ideas used for regression also apply to other supervised learning settings involving quantitative responses, including survival-related problems.
Explanation
Many modeling and evaluation principles are shared across supervised learning tasks.
- 9
What does a linear model use to predict the response for observation i?
Model answer
It uses an intercept, feature values x_{i1},dots,x_{iP}, corresponding coefficients, and a noise term: y_i = eta_0 + eta_1x_{i1} + dots + eta_Px_{iP} + epsilon_i.
Explanation
The coefficients quantify how the features contribute to the predicted response, while ϵi​ represents unexplained variation.
- 10
What do n, P, yi​, and xij​ represent in a linear model?
Model answer
n is the number of observations, P is the number of features, yi​ is the response for observation i, and xij​ is the value of feature j for observation i.
Explanation
These quantities identify the sample size, predictor dimension, outcome, and individual feature measurements.
- 11
What is the role of the coefficients beta_0,dots,beta_P in a linear model?
Model answer
They determine the intercept and the contribution of each feature to the predicted response, and they must be estimated when fitting the model.
Explanation
The coefficients are unknown parameters learned from the training data.
- 12
What objective does least squares use to fit a linear model?
Model answer
Least squares chooses coefficient estimates to minimize the residual sum of squares, ∑i​(yi​−y^​i​)2.
Explanation
The method selects the model whose fitted values have the smallest total squared prediction errors on the training data.
- 13
What are the residual sum of squares and the fitted value?
Model answer
The residual sum of squares is ∑i​(yi​−y^​i​)2, and y^​i​ is the model's fitted or predicted value for observation i.
Explanation
Each residual measures the difference between an observed response and its fitted value.
- 14
How does a least squares plane extend least squares regression with two predictors?
Model answer
With two predictors, the fitted values form a plane rather than a line, positioned to minimize the sum of squared vertical residuals.
Explanation
The number of predictors determines the geometric dimension of the fitted linear surface.
- 15
What do the vertical residual distances represent in a least squares plot?
Model answer
They represent the differences yi​−y^​i​ between observed responses and their model predictions.
Explanation
Least squares positions the fitted surface so that the sum of the squared residual distances is as small as possible.
- 16
When does least squares generally work well?
Model answer
It generally works well when the number of observations, n, is large and the number of features, P, is small.
Explanation
This setting provides substantial information relative to the model's complexity.
- 17
What is a training set?
Model answer
A training set is the data used to fit a model and estimate its parameters.
Explanation
The model learns its coefficients or structure from the training observations.
- 18
How is training error commonly measured in regression?
Model answer
Training error is commonly measured by mean squared error, n1​∑i​(yi​−y^​i​)2, calculated on the training data.
Explanation
Mean squared error is the residual sum of squares divided by the number of observations.
- 19
Why is least squares guaranteed to produce a relatively small training error?
Model answer
Because its coefficients are chosen specifically to minimize the training residual sum of squares, and therefore the training mean squared error.
Explanation
Optimization on the training data directly favors a small error on that same data.
- 20
What is the relationship between training error and R2?
Model answer
They are closely related: a larger R2 corresponds to a smaller training error.
Explanation
Both summarize how well the fitted model explains the training observations.
- 21
Why does training error decrease or stay the same as variables are added to a model?
Model answer
Adding variables enlarges the set of models available for fitting, so the model can reproduce the previous fit or improve it; consequently, training error cannot increase.
Explanation
The expanded model can assign a coefficient of zero to a new variable if it provides no improvement.
- 22
Why can a model have zero training error but poor predictive performance?
Model answer
A sufficiently complex model can overfit the training observations, capturing noise rather than general patterns and therefore performing poorly on new data.
Explanation
Perfect fit to known observations does not guarantee accurate predictions for observations not used during fitting.
- 23
Why is test error more important than training error in supervised learning?
Model answer
Test error measures how accurately a model predicts new observations whose responses were not used to fit the model.
Explanation
The practical goal is prediction for future or unseen cases, not reconstruction of outcomes already known.
- 24
Define test error for a regression model.
Model answer
Test error is the average squared difference between the actual responses and predictions for observations not used to fit the model: m1​∑i=1m​(yitest​−y^​itest​)2.
Explanation
It evaluates predictive accuracy on a test set rather than on the training observations.
- 25
How does test error typically change as model complexity increases?
Model answer
Test error often decreases initially, reaches a minimum at an intermediate complexity, and then increases as the model becomes too complex.
Explanation
The increase at high complexity reflects overfitting.
- 26
What is overfitting?
Model answer
Overfitting occurs when a model has low training error but high test error because it fits the training data too closely.
Explanation
Overfit models learn sample-specific noise instead of patterns that generalize.
- 27
Why can a simple linear model still overfit?
Model answer
Even a linear model can be too complex when the amount of data is very small relative to the model, such as fitting a line using only two observations.
Explanation
Complexity depends on the relationship between the model and available data, not only on the model's apparent form.
- 28
What is model complexity?
Model answer
Model complexity describes how flexible a model is in fitting patterns in the data; the number of variables is one possible measure, but not the only one.
Explanation
Regularization, transformations, trees, and other methods can change complexity without simply changing the number of variables.
- 29
Why is the number of variables not always a sufficient measure of model complexity?
Model answer
Different methods can use the same number of variables while having different flexibility, as illustrated by ridge regression, which uses all variables but can strongly shrink their coefficients.
Explanation
Complexity depends on how a method uses the predictors, not merely on how many predictors appear.
- 30
Define bias in the context of estimated model coefficients.
Model answer
Bias is the average difference between an estimated coefficient, β^​, and the true coefficient, β, across repeated experiments.
Explanation
It describes how far the estimator is from the truth on average.
- 31
Define variance in the context of estimated model coefficients.
Model answer
Variance is the amount by which an estimated coefficient, β^​, changes across repeated experiments.
Explanation
It measures the instability of the estimator across different samples.
- 32
How does increasing model complexity affect bias and variance?
Model answer
Increasing complexity generally decreases bias but increases variance.
Explanation
More flexible models fit the underlying pattern more closely but are more sensitive to the particular training sample.
- 33
What is the bias-variance trade-off?
Model answer
The trade-off is that reducing squared bias through greater complexity tends to increase variance, so the best model balances both to minimize test error.
Explanation
Test error can be understood as involving squared bias plus variance, so neither extreme complexity nor extreme simplicity is usually optimal.
- 34
What happens to bias and variance in a very simple model?
Model answer
A very simple model tends to have high bias and low variance, which can produce high test error because it underfits the data.
Explanation
Its limited flexibility prevents it from representing important relationships.
- 35
What happens to bias and variance in a highly complex model?
Model answer
A highly complex model tends to have low bias and high variance, which can produce high test error because it overfits the data.
Explanation
Although it can fit the underlying pattern closely, it is overly sensitive to noise in the training sample.
- 36
What is the validation-set approach for estimating test error?
Model answer
The data are split into a training set and a validation set; the model is fitted on the training set and evaluated on the validation set.
Explanation
The validation set acts as an approximation to unseen test data.
- 37
What is the main weakness of the validation-set approach?
Model answer
Its test-error estimate depends on the arbitrary split of the observations, so a different split may produce a different estimate.
Explanation
The estimate can vary because different observations are assigned to training and validation sets.
- 38
Describe leave-one-out cross-validation.
Model answer
A model is fitted n times, each time leaving out one observation, evaluating the prediction on that observation, and averaging the resulting errors.
Explanation
Every observation serves once as the validation observation while all other observations serve as training data.
- 39
What is the main advantage of leave-one-out cross-validation?
Model answer
It systematically uses every observation as a validation case, providing a thorough estimate that is less dependent on one arbitrary split.
Explanation
The procedure evaluates all possible single-observation holdouts.
- 40
What is the main disadvantage of leave-one-out cross-validation?
Model answer
It can be computationally expensive because it requires fitting n separate models.
Explanation
The computational cost becomes undesirable when the sample size is very large.
- 41
Describe k-fold cross-validation.
Model answer
The observations are divided into k groups; the model is trained on k−1 groups and evaluated on the remaining group, repeating until every group has served as the validation set, after which the errors are averaged.
Explanation
For example, five-fold cross-validation trains on four groups and tests on the fifth in each of five repetitions.
- 42
Why is k-fold cross-validation often preferred to leave-one-out cross-validation?
Model answer
It provides a systematic test-error estimate while requiring only k model fits rather than n fits, making it more computationally practical.
Explanation
It reduces computational cost while still rotating observations through training and validation roles.
- 43
How should cross-validation be used when selecting model complexity?
Model answer
Fit candidate models with different complexity levels, estimate each model's test error using cross-validation, and choose the complexity with the smallest estimated test error.
Explanation
The procedure targets predictive performance rather than training fit.
- 44
Why can least squares overfit biomedical big data?
Model answer
Biomedical data may contain far more features than observations, such as thousands of genes or proteins, allowing least squares to fit noise and produce high test error.
Explanation
A large feature-to-observation ratio makes the least squares model too flexible for the available data.
- 45
What is regularization?
Model answer
Regularization, also called penalization, fits a model by balancing its training-data fit against a penalty for model complexity.
Explanation
The penalty discourages overly flexible models and can improve test performance.
- 46
How do ridge regression and the lasso reduce model complexity?
Model answer
Both methods shrink regression coefficients toward zero by adding a penalty to the least squares objective.
Explanation
Shrinking coefficient estimates reduces the effective flexibility of the fitted model.
- 47
What objective does ridge regression minimize?
Model answer
Ridge regression minimizes ∑i​(yi​−y^​i​)2+λ∑j=1P​β^​j2​, where λ≥0 controls the penalty strength.
Explanation
The first term measures training error and the squared-coefficient term penalizes model complexity.
- 48
What does the ridge tuning parameter, λ, control?
Model answer
λ controls the strength of coefficient shrinkage and therefore the effective complexity of the model.
Explanation
Larger values place greater emphasis on keeping coefficients small.
- 49
What happens in ridge regression when λ=0?
Model answer
The penalty disappears, so ridge regression becomes ordinary least squares.
Explanation
With no penalty, the objective contains only the residual sum of squares.
- 50
What happens to ridge coefficients as λ becomes very large?
Model answer
The coefficient estimates approach zero, producing a very simple, low-variance model with potentially high bias.
Explanation
A large penalty makes large coefficients too costly.
- 51
Does ridge regression perform feature selection?
Model answer
No. Ridge regression shrinks coefficients toward zero but generally does not make them exactly zero, so the final model includes all features.
Explanation
Its model can be effectively simple while still containing every predictor.
- 52
How should λ be selected for ridge regression?
Model answer
Select the value of λ that gives the smallest estimated test error, often using a validation set or cross-validation.
Explanation
The tuning parameter should be chosen for predictive performance rather than training fit.
- 53
Why must ridge regression be refit on the full data after selecting λ?
Model answer
After choosing λ using a subset-based evaluation, ridge regression should be refit using all observations with that selected value to use the available training information.
Explanation
The final model benefits from all observations while retaining the complexity level selected during validation.
- 54
What objective does the lasso minimize?
Model answer
The lasso minimizes ∑i​(yi​−y^​i​)2+λ∑j=1P​∣β^​j​∣.
Explanation
Its absolute-value penalty differs from ridge regression's squared-coefficient penalty.
- 55
What is the key difference between the lasso and ridge regression penalties?
Model answer
The lasso uses an absolute-value penalty, ∑j​∣β^​j​∣, whereas ridge regression uses a squared-coefficient penalty, ∑j​β^​j2​.
Explanation
This seemingly small change gives the lasso the ability to set coefficients exactly to zero.
- 56
Why does the lasso perform feature selection?
Model answer
For suitable intermediate values of λ, the lasso sets some coefficient estimates exactly equal to zero, leaving only a subset of features in the model.
Explanation
A coefficient of zero removes that feature from the fitted prediction equation.
- 57
What is a sparse model?
Model answer
A sparse model is one in which many coefficient estimates are exactly zero.
Explanation
Sparsity means that the model uses only a relatively small subset of the available features.
- 58
When is the lasso preferable to ridge regression?
Model answer
The lasso is preferable when a model using only a subset of features is desired, such as a clinical predictor involving a manageable number of genes.
Explanation
Feature selection can make a model less expensive and easier to interpret or translate into practice.
- 59
What happens to the lasso when λ=0 and when λ is very large?
Model answer
When λ=0, the lasso reduces to least squares; when λ is very large, all coefficients are driven exactly to zero.
Explanation
The penalty ranges from absent to strong enough to eliminate all fitted feature effects.
- 60
What is dimension reduction?
Model answer
Dimension reduction represents data with fewer dimensions while retaining as much important variation or structure as possible.
Explanation
It can reduce redundancy and noise when the original feature space is high-dimensional.
- 61
Why might the original dimensions of a feature space be inefficient?
Model answer
Some dimensions may be redundant because features are highly correlated, while others may be uninformative noise features.
Explanation
Reducing the representation can remove unnecessary or weakly informative directions.
- 62
What is principal components regression?
Model answer
Principal components regression creates principal components from the original predictors and fits a least squares model using only the first m components.
Explanation
It combines dimension reduction with ordinary least squares.
- 63
How are principal components constructed?
Model answer
Principal components are linear combinations of the original variables chosen to capture as much variability in the data as possible.
Explanation
The first component identifies the direction of greatest variation, followed by directions explaining progressively less variation.
- 64
How does principal components regression remain linear in the original predictors?
Model answer
Because each component is itself a linear combination of the original predictors, a linear model fitted to the components is also linear in the original predictors.
Explanation
The transformation changes the representation of the predictors without making the final relationship nonlinear.
- 65
How does the number of principal components control model complexity?
Model answer
Using all P components gives least squares, while using fewer than P components produces a less complex model.
Explanation
The number m of retained components determines how much of the original feature space is used.
- 66
Does principal components regression perform feature selection?
Model answer
No. All original predictors generally contribute to the retained components, even when only a few components are used.
Explanation
Dimension reduction combines predictors rather than eliminating individual predictors.
- 67
How should the number of principal components be selected?
Model answer
Choose the number of components that minimizes estimated test error.
Explanation
Retaining components solely because they explain feature variation does not guarantee good prediction of the response.
- 68
Why can principal components regression fail as a predictive method?
Model answer
The components that explain the most variation in the predictors are not necessarily the components most predictive of the response.
Explanation
Principal components are constructed without using the response variable.
- 69
What is a partial least squares method in relation to principal components regression?
Model answer
Partial least squares is another dimension-reduction approach similar in general purpose to principal components regression.
Explanation
Both methods create lower-dimensional predictor representations before fitting a predictive model.
- 70
How can a linear model be made more complex when least squares is too simple?
Model answer
Add transformations and combinations of features, such as xj2​, xj3​, exj​, or interaction terms such as xj​xk​.
Explanation
These added features allow least squares or regularized methods to represent more flexible relationships.
- 71
What should be done after adding transformations or interactions to a model?
Model answer
The model's test error should be estimated to determine whether the added complexity improves generalization.
Explanation
A more flexible model may fit the training data better but still have worse performance on new data.
- 72
How do the principles discussed for regression apply to classification?
Model answer
The same principles, including model complexity, overfitting, bias-variance considerations, and test-error evaluation, apply to classification.
Explanation
The response type changes, but the central supervised-learning reasoning remains the same.
- 73
What is the basic idea of a decision tree?
Model answer
A decision tree partitions the feature space into regions or boxes and makes a prediction within each region.
Explanation
A sequence of feature-based decisions determines which region receives a new observation.
- 74
Why are decision trees considered interpretable?
Model answer
Their sequence of simple splits can be displayed as a diagram that allows a user to follow decisions and obtain a prediction without understanding complex mathematics.
Explanation
The tree structure makes the prediction path explicit.
- 75
How is a prediction obtained within a regression-tree region?
Model answer
The prediction is the average response of the training observations that fall within that region.
Explanation
Each terminal region receives a constant prediction based on its assigned observations.
- 76
How would a regression tree classify an observation?
Model answer
Starting at the top, follow the branch determined by each feature-based split until reaching a terminal region, then use that region's prediction.
Explanation
A yes or left decision and a no or right decision define the observation's path through the tree.
- 77
Why might salary be modeled on a logarithmic scale in a regression tree?
Model answer
Modeling salary on a log scale can provide a more suitable linear-scale representation for salary differences; a prediction on the log scale can be converted using eprediction and then multiplied by 1,000 when the units are thousands of dollars.
Explanation
The tree's reported prediction represents log salary rather than salary directly.
- 78
What is the main strength and main weakness of regression trees?
Model answer
Their main strength is interpretability, while their main weakness is that they are typically less accurate than other supervised learning methods.
Explanation
Trees are useful when users need a transparent decision process, but not necessarily when maximum predictive accuracy is the priority.
- 79
What happens when a decision tree is too large?
Model answer
A large tree tends to overfit the training data, producing low bias but high variance.
Explanation
Many splits make the tree highly flexible and sensitive to sample-specific noise.
- 80
What happens when a decision tree is too small?
Model answer
A small tree tends to underfit the data, producing low variance but potentially high bias.
Explanation
Too few splits may prevent the tree from representing important relationships.
- 81
How should the size of a decision tree be selected?
Model answer
Estimate test error for different tree sizes and select the size with the lowest estimated test error.
Explanation
This balances the underfitting risk of a small tree against the overfitting risk of a large tree.
- 82
What are batch effects?
Model answer
Batch effects are variability in data caused by nonbiological factors, such as differences in experimental runs, laboratories, or institutions.
Explanation
They can create apparent biological patterns that actually reflect how or where the data were collected.
- 83
Why can batch effects invalidate biomedical machine-learning results?
Model answer
Batch effects can make a model appear to predict well by exploiting nonbiological differences rather than genuine biological relationships.
Explanation
Even an apparently good test error can be misleading if training and test data share the same batch-specific artifacts.
- 84
How can experimental design reduce batch effects?
Model answer
Researchers should randomize sample run times, avoid processing all cases before all controls, and reduce other extraneous sources of variation.
Explanation
Randomization prevents biological groups from becoming confounded with experimental batches.
- 85
Why is it useful to collect data across multiple laboratories or institutions?
Model answer
Training on data from multiple laboratories or institutions can make the model less dependent on a single dataset's batch-specific characteristics.
Explanation
Broader data collection exposes the model to more sources of experimental variation.
- 86
What is independent validation, and why is it important?
Model answer
Independent validation evaluates results on a separate dataset collected in a different laboratory or institution; it helps determine whether findings generalize beyond batch-specific effects.
Explanation
A model that performs well only on data sharing the original batch effects may fail during independent validation.
- 87
Why is there no universally best supervised-learning method?
Model answer
Different methods perform differently in different data settings, so no single approach is best for every problem.
Explanation
Method choice should be guided by predictive performance, interpretability needs, and the structure of the data.
- 88
How can a supervised-learning approach be wrong even if no approach is universally best?
Model answer
An approach can be wrong if it is applied or evaluated incorrectly, such as performing cross-validation improperly and obtaining an invalid test-error estimate.
Explanation
Incorrect evaluation can lead to selecting a model that appears effective but predicts poorly.
- 89
Why is non-normality of errors often less serious than excessive model complexity?
Model answer
With a sufficiently large sample, non-normal errors may not seriously harm estimation, whereas a model that is too complex for the available data can perform poorly regardless of the data distribution.
Explanation
The relationship between sample size and model complexity is often more important than Gaussian error assumptions.
- 90
What does the curse of dimensionality refer to in this context?
Model answer
It refers to the difficulty of building reliable predictive models when many features encourage excessive complexity relative to the available observations.
Explanation
More measured variables do not automatically produce better predictions and can instead increase test error through overfitting.
- 91
Why is test error a universal way to compare models with different structures?
Model answer
Test error measures predictive performance using the same criterion regardless of whether the model is least squares, ridge, lasso, principal-components regression, or a decision tree.
Explanation
Unlike simply counting variables, test error can compare models with very different forms and complexity definitions.

Ask anything
We've read this whole study set, so questions about it get the best answers.