wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Recall: Error Metrics and Model Selection Basics

Total questions: 101

Worksheet time: 51mins

Name
Class
Date
1.

In regression, which expression correctly defines the Mean Square Error (MSE) over N observations?

a)

MSE = (1/N)Σi=1Nyiy^i(1/N) \Sigma_{i=1}^N |y_i − ŷ_i|

b)

MSE = (1/N)Σi=1N(yiy^i)2(1/N) \Sigma_{i=1}^N (y_i − ŷ_i)^2

c)

MSE = Σi=1N(yiy^i)Σ_{i=1}^N (y_i − ŷ_i)

d)

MSE = (1/N2)Σi=1N(yiy^i)2(1/N^2) Σ_{i=1}^N (y_i − ŷ_i)^2

2.

For classification, the error rate shown is (1/N)Σi=1NI(yiy^i)(1/N) Σ_{i=1}^N I(y_i ≠ ŷ_i) . What does the indicator function I(yiy^i)I(y_i ≠ ŷ_i) contribute to the sum?

a)

It adds the squared difference when predictions disagree.

b)

It adds 1 for a misclassification and 0 otherwise.

c)

It adds the absolute difference between class labels.

d)

It subtracts 1 when predictions match and adds 0 otherwise.

3.

In the MSE and error rate definitions, what do y_i and ŷ_i represent, respectively?

a)

The i-th residual and the i-th squared error

b)

The i-th observation and its estimate

c)

The i-th predicted value and the model’s parameter

d)

The i-th feature value and its standardized form

4.

Suppose a regression model produces predictions ŷ = [2, 4, 6] for true values y = [1, 5, 7]. What is the MSE using the given formula?

a)

(1/3)[(12)2+(54)2+(76)2]=(1/3)[1+1+1]=1(1/3)·[(1−2)^2 + (5−4)^2 + (7−6)^2] = (1/3)·[1 + 1 + 1] = 1

b)

(1/3)·[(1−2) + (5−4) + (7−6)] = (1/3)·[1 + 1 + 1] = 1

c)

(1/9)[(12)2+(54)2+(76)2]=1/3(1/9)·[(1−2)^2 + (5−4)^2 + (7−6)^2] = 1/3

d)

(1/3)·|[(1−2) + (5−4) + (7−6)]| = 1

5.

Which scenario best motivates using error rate instead of MSE for model evaluation?

a)

Predicting numeric outcomes like house prices.

b)

Estimating continuous temperatures from sensor data.

c)

Classifying emails as spam or not spam.

d)

Fitting a polynomial curve to measured positions.

6.

When selecting a model for tabular classification, which statement aligns with the listed options (KNN, Logistic Regression, Random Forest)?

a)

Only Random Forest can handle tabular data; KNN and Logistic Regression cannot.

b)

KNN, Logistic Regression, and Random Forest are common choices whose advantages can be compared for the best fit.

c)

Logistic Regression is suitable only for regression tasks, not classification.

d)

KNN requires no notion of distance among data points in its design.

7.

In supervised regression, which statement best distinguishes training error from test error?

a)

Training error is the average error on the training dataset; test error is the average error on new observations not used in training.

b)

Training error is measured with classification accuracy; test error is measured with mean squared error.

c)

Training error equals zero for any properly trained model; test error is nonzero.

d)

Training error depends only on model complexity; test error depends only on dataset size.

8.

A model shows very low error on the training set but substantially higher error on unseen data. Which phenomenon is most consistent with this observation?

a)

Underfitting due to high bias and low variance

b)

Proper generalization with balanced bias-variance

c)

Overfitting due to low bias and high variance

d)

Data leakage eliminated by strict separation

9.

Which reason explains why training error can dramatically underestimate test error?

a)

Training error is computed using a loss different from the test loss.

b)

Training error benefits from having seen the exact samples used to fit the parameters, while test error evaluates performance on new, unseen samples.

c)

Test error is always inflated by random noise added at evaluation time.

d)

Training error uses larger datasets than test error by design.

10.

Consider the plotted curves of prediction error versus model complexity with separate lines for training and test samples. What general trend is depicted for the test error as complexity increases beyond an optimal point?

a)

Test error continually decreases with complexity.

b)

Test error decreases at first, reaches a minimum, then increases as complexity becomes too high.

c)

Test error is constant across all complexity levels.

d)

Test error mirrors the training error exactly at every complexity level.

11.

On the bias-variance spectrum shown on the diagram, which region corresponds to overfitting?

a)

High bias, low variance (left side of the complexity axis)

b)

Low bias, high variance (right side of the complexity axis)

c)

Moderate bias and variance (center)

d)

Bias and variance both zero (anywhere)

12.

Which description aligns with underfitting in the context of model complexity and error?

a)

Model too simple, high bias, low variance, leading to high error on both training and test sets.

b)

Model too complex, low bias, high variance, leading to low training error but high test error.

c)

Model with perfect complexity, achieving zero test error.

d)

Model with high variance and low bias but low training error only.

13.

According to the notes, models that are too complex for the amount of training data available tend to:

a)

Generalize well to new examples.

b)

Overfit, exhibiting high variance and low bias.

c)

Underfit, exhibiting high bias and low variance.

d)

Match training and test errors exactly.

14.

Which question from the material prompts consideration of data size as a remedy for overfitting?

a)

Can regularization increase variance?

b)

Can very large datasets solve this problem?

c)

Is training error equal to test error?

d)

Should we always use linear models?

15.

Generalization ability is defined as an algorithm’s capacity to:

a)

Minimize training loss without constraints.

b)

Give accurate predictions for new, previously unseen data.

c)

Maximize the number of parameters in a model.

d)

Reduce variance to zero regardless of bias.

16.

Which assumption underlies evaluation on a test set when discussing generalization?

a)

The test set follows a different distribution than the training set.

b)

Future unseen data will share the same distributional properties as the training sets.

c)

Training accuracy is always higher than test accuracy.

d)

The model must be tuned only on the test set for fairness.

17.

Given the assumptions, why might a model accurate on the training set not be accurate on the test set?

a)

The model was tuned too specifically to the training set, reducing its ability to generalize.

b)

The test set always contains fewer samples than the training set.

c)

Accuracy cannot be computed on unseen data.

d)

Training and test sets must be identical to compare accuracy.

18.

Which scenario most likely yields the lowest training error according to the diagram and discussion?

a)

A highly complex model that continues reducing training error as complexity increases.

b)

A simple model with high bias.

c)

A model at the complexity minimizing test error.

d)

A model trained on a test set only.

19.

Which pair correctly matches model property with expected behavior on training and test sets?

a)

High bias, low variance: low training error, low test error

b)

Low bias, high variance: very low training error, higher test error

c)

Low bias, low variance: high training error, high test error

d)

High bias, high variance: optimal generalization

20.

According to the definition provided, what is the core idea of cross-validation for estimating test error?

a)

Training on the full dataset multiple times to reduce variance

b)

Holding out a subset of training observations during fitting and applying the learning method to those held-out observations

c)

Using only the test set for parameter tuning and final evaluation

d)

Randomly shuffling labels to detect model bias

21.

In the depicted workflow diagram, which step uses the held-out data to choose model settings before retraining on the full training data?

a)

Final evaluation

b)

Best parameters selection via cross-validation

c)

Dataset split into training and test sets

d)

Retrained model inference

22.

Which statement best describes why the validation set approach is introduced?

a)

To increase the size of the test set for better evaluation

b)

To avoid overfitting that results from using the test set multiple times to select hyperparameters

c)

To ensure models always have low bias by reducing training data

d)

To eliminate variance by averaging across many folds

23.

Which description correctly defines a hyperparameter in this context?

a)

A learned weight that minimizes training loss

b)

A parameter set after training to adjust model outputs

c)

A configurable setting that defines some part of the model’s learning process

d)

A constant that fixes the dataset split ratio

24.

Based on the validation-test approach description, what operational step characterizes it?

a)

Using the entire dataset for both fitting and evaluation

b)

Holding out a subset of training observations from fitting and applying the learning method to those held-out observations

c)

Fitting on the test set and validating on the training set

d)

Selecting parameters by minimizing test error directly

25.

Which is listed as a pro of the validation set approach?

a)

High accuracy regardless of sampling

b)

Fast and simple

c)

Guaranteed unbiased error estimate

d)

Eliminates variance in parameter selection

26.

Which is a stated con of the validation set approach?

a)

Requires complex implementation and long runtimes

b)

Validation error always underestimates the true error

c)

Results are highly variable depending on the particular sampling

d)

Cannot be used to select hyperparameters

27.

What tendency of validation error is noted in the material?

a)

It tends to exactly match the true error

b)

It tends to underestimate the true error

c)

It tends to overestimate the true error

d)

It is unrelated to the true error

28.

In the validation set approach shown, the dataset is first split using train_test_split with test_size=0.4 and random_state=0. What proportion of the data becomes the test set in this first split?

a)

20%

b)

40%

c)

50%

d)

60%

29.

After the first split, a second train_test_split is applied to the training+validation portion with test_size=0.2 and random_state=0 to create X_train, X_val, y_train, y_val. Relative to the train+validation pool, what fraction is allocated to the validation set?

a)

0.1

b)

0.2

c)

0.3

d)

0.4

30.

The Breast Cancer Wisconsin dataset is loaded via datasets.load_breast_cancer(return_X_y=True). Which classifier is used to evaluate different hyperparameter values in the example?

a)

LogisticRegression

b)

DecisionTreeClassifier

c)

KNeighborsClassifier

d)

SVC

31.

In the hyperparameter search loop, neighbors = np.arange(1, 15, 2). What values of n_neighbors are evaluated?

a)

1 through 14 with step 1

b)

1, 3, 5, ..., 13

c)

2, 4, 6, ..., 14

d)

5, 7, 9, ..., 15

32.

Based on the plotted validation accuracy versus n_neighbors, and the printed output, which n_neighbors gives the best validation score and what is that score?

a)

n_neighbors=9 with score≈0.975

b)

n_neighbors=11 with score≈0.981

c)

n_neighbors=13 with score≈0.970

d)

n_neighbors=7 with score≈0.960

33.

After selecting the best n_neighbors, the model is refit on X_trainval, y_trainval and evaluated on X_test, y_test. What is the reported test-set accuracy?

a)

0.945

b)

0.965

c)

0.981

d)

0.972

34.

In the validation set approach, why can the estimated test error be highly variable across different runs?

a)

Because the loss function itself changes randomly with each run

b)

Because the split of observations between the training and validation sets varies, altering which data the model sees

c)

Because model parameters are fixed and thus amplify noise

d)

Because validation errors are averaged over many distinct models

35.

According to the drawbacks listed, why might the validation set error tend to overestimate the test error for a model fit on the entire data set?

a)

The validation set is always larger than the training set

b)

The model is trained on only a subset of observations, so it has less data than it would when fit on the full data set

c)

Validation metrics inherently bias downward

d)

The training algorithm stops early during validation

36.

Which statement best captures a limitation of training with a single validation split?

a)

It guarantees identical performance estimates across splits

b)

It ensures the model uses all observations equally

c)

It uses only the observations assigned to the training set for fitting, potentially missing important patterns

d)

It removes the need for hyperparameter tuning

37.

What primary goal motivates the introduction of resampling methods in model assessment?

a)

To decrease the number of observations needed in a study

b)

To obtain more robust estimates of model performance when multiple separate training/testing sets are not available

c)

To replace statistical inference with deterministic rules

d)

To eliminate the need for a validation set entirely

38.

Which actions are core to resampling techniques as described?

a)

Drawing one large sample once and fixing the model

b)

Repeatedly drawing samples from a training set and refitting the model on each sample

c)

Only evaluating a single hyperparameter setting

d)

Aggregating predictions without refitting

39.

What additional benefit do resampling methods provide beyond a single train/validation split?

a)

They guarantee zero test error

b)

They provide additional information about the fitted model that would not otherwise be available

c)

They reduce computational cost in all scenarios

d)

They ensure the training set never changes

40.

Which resampling techniques are explicitly named as examples?

a)

Bagging and boosting

b)

Cross-validation (CV) and bootstrapping

c)

Grid search and random search

d)

Regularization and ensembling

41.

What is one noted drawback of resampling approaches?

a)

They cannot be implemented on modern computers

b)

They are computationally expensive, though less so now due to advances in computing power

c)

They always underfit the data

d)

They require labeled data to be discarded

42.

In the automobile data example, the left plot shows mean squared error versus degree of polynomial for a single split. What does the right plot illustrate by contrast?

a)

A single fit with regularization only

b)

Multiple splits, each tracing mean squared error across polynomial degrees

c)

A time series of model errors

d)

A comparison between classification and clustering

43.

In the automobile data example, the dataset contains 392 observations and is split into equal halves. Which variables are listed as features besides mpg?

a)

cylinders, displacement, horsepower, weight, acceleration, year, origin, name

b)

cylinders, torque, horsepower, curb weight, acceleration, model, country, manufacturer

c)

gears, torque, horsepower, mass, speed, date, origin, label

d)

displacement, efficiency, horsepower, load, acceleration, date, origin, code

44.

In Leave-One-Out Cross-Validation (LOOCV), how are the training and validation sets formed for each iteration?

a)

The data is split once into fixed 50% training and 50% validation subsets.

b)

All observations except one form the training set, and the held-out single observation forms the validation set.

c)

Random disjoint halves of the data are used as training and validation, repeated k times.

d)

Each iteration uses a different 70/30 split between training and validation.

45.

Which statement best describes how LOOCV estimates the test error?

a)

It chooses the smallest MSE from all iterations.

b)

It averages the mean squared errors across all n validation folds, one per observation.

c)

It multiplies the training error by a penalty factor for model complexity.

d)

It uses a bootstrap estimate of prediction error without averaging.

46.

Suppose a dataset has n observations. How many distinct validation sets are created in LOOCV?

a)

1

b)

log2(n)

c)

n

d)

n−1

47.

Consider the formula CV(n)=(1/n)i=1nMSEiCV(n) = (1/n) \sum_{i=1}^n MSE_i shown in the material. What does MSE_i represent in this context?

a)

The training error on the i-th training set.

b)

The mean squared error computed on the single held-out observation in fold i.

c)

The average MSE across all observations.

d)

The MSE of a model fit to the entire dataset without cross-validation.

48.

Which of the following is a characteristic of LOOCV compared to the simple validation set approach?

a)

LOOCV tends to overestimate the test error rate.

b)

LOOCV tends not to overestimate the test error rate relative to the validation set approach.

c)

LOOCV always produces zero test error.

d)

LOOCV ignores the degree of the fitted polynomial.

49.

In the schematic diagram, the first training set contains all observations except observation 1, the second contains all except observation 2, and so on. What is the validation set in the second iteration?

a)

All observations except observation 2.

b)

Only observation 2.

c)

Observations 1 and 2.

d)

No observations; validation uses training error.

50.

When applying LOOCV to select a polynomial degree for predicting mpg from horsepower (as in the plot), what quantity is evaluated across degrees?

a)

Training accuracy.

b)

Mean Squared Error estimated by LOOCV.

c)

Number of parameters in the model.

d)

Residual sum of squares on the full dataset.

51.

In k-fold cross-validation, which step correctly describes how the data is used across folds? Choose the best description.

a)

Use all folds only as training data and report a single score.

b)

Use fold-1 as test data while the remaining folds serve as training data; repeat for each fold and aggregate scores.

c)

Randomly select one observation as test and train on the rest without repeating.

d)

Train one model on the entire dataset and validate on a separate external dataset only.

52.

Which statement best captures a benefit of using k-fold cross-validation mentioned in the material?

a)

It eliminates the need to train multiple models.

b)

It guarantees zero bias in the evaluation.

c)

It provides more stable estimates by training multiple models and uses a larger fraction of data for training.

d)

It always uses 100% of the data for training in each fold.

53.

When using 10-fold cross-validation, approximately what proportion of the data is used for training in each iteration?

a)

10%

b)

50%

c)

90%

d)

100%

54.

According to the schematic of 5-fold CV, how is test error estimated?

a)

By selecting the lowest MSE across folds.

b)

By averaging the five resulting MSE estimates from the validation folds.

c)

By averaging training losses only.

d)

By computing the median residual across all observations.

55.

Which formula defines the overall cross-validation score for regression across K parts as presented?

a)

CV(K) = MSEtrain + MSEtest

b)

CV(K) = (1/K)k=1KMSEk(1/K) \sum_{k=1}^K MSE_k

c)

CV(K) = k=1K(nk/n)MSEk\sum_{k=1}^K (n_k / n) MSE_k

d)

CV(K) = i=1n(yiy^i)2\sum_{i=1}^n (y_i − ŷ_i)^2

56.

In the definition of MSE_k used in the regression details, what is ŷ_i?

a)

The true response for observation i.

b)

The residual for observation i within part k.

c)

The fit (predicted value) for observation i obtained from data with part k excluded.

d)

The average response across all folds.

57.

If n is a multiple of K, what is the relationship between n_k and n in each part k according to the material?

a)

n_k = K/n

b)

n_k = n/K

c)

n_k = n − K

d)

n_k = K

58.

Setting K = n corresponds to which special case of cross-validation?

a)

Stratified k-fold

b)

Repeated k-fold

c)

n-fold or leave-one-out cross-validation (LOOCV)

d)

Holdout validation

59.

Which drawback of k-fold cross-validation is directly tied to training many models as K increases?

a)

Lower computational cost

b)

Higher computational cost

c)

Guaranteed absence of data leakage

d)

Perfect suitability for sequential data

60.

Which situation is noted as problematic for standard k-fold cross-validation?

a)

Balanced datasets with independent observations

b)

Highly imbalanced datasets and sequential data

c)

Small datasets with no labels

d)

High-dimensional features only

61.

What is the bias–variance implication of choosing a small k (e.g., 3-fold) as described?

a)

Lower bias and higher variance with heavy computation.

b)

Higher bias and lower computational cost due to fewer training samples.

c)

Higher bias and lower computational cost due to more training samples.

d)

Higher bias and lower variance with heavy computation.

62.

What is the bias–variance implication of choosing a large k (e.g., 20-fold or leave-one-out) according to the material?

a)

Lower bias, but high variance and heavy computation.

b)

Higher bias, low variance, light computation.

c)

Lower bias, low variance, light computation.

d)

Higher bias, high variance, heavy computation.

63.

Which risk is mentioned as a potential issue in k-fold cross-validation that can compromise evaluation integrity?

a)

Over-regularization of the model

b)

Data leakage or overlap between folds

c)

Insufficient number of features

d)

Excessive label noise always present

64.

Based on the left diagram titled "LOOCV vs 5-fold CV", which statement best describes how LOOCV partitions the data for validation? Refer to the visual showing many rows where a single orange block shifts position across rows.

a)

It splits the dataset into five equal folds and validates on one fold at a time.

b)

It leaves out exactly one observation at a time for validation while training on the remaining n−1 observations.

c)

It randomly holds out half the data for validation and trains on the other half.

d)

It validates on all observations simultaneously without retraining.

65.

In the right diagram labeled "5-fold CV", what does each orange segment within a row represent? Use the depiction of blue training blocks with a moving orange validation block.

a)

The cumulative validation error across all folds.

b)

A single fold used as the validation set while the remaining folds serve as training data.

c)

An outlier removed before fitting the model.

d)

A bootstrap resample used for training.

66.

According to the caption beneath the first figure, which relationship between LOOCV and k-fold CV is correct?

a)

LOOCV is unrelated to k-fold CV.

b)

LOOCV is a special case of k-fold CV when k = 1.

c)

LOOCV equals k-fold CV when k = N − 1.

d)

LOOCV becomes k-fold CV only when k = 5.

67.

From the second set of plots comparing LOOCV and 10-fold CV across polynomial degrees, which feature is highlighted for 10-fold CV by the note "Run 9 times"?

a)

10-fold CV requires no repetition because folds are fixed.

b)

10-fold CV is typically repeated multiple times with different splits to stabilize the estimate.

c)

10-fold CV trains on fewer observations than LOOCV in each repetition, leading to higher bias by design.

d)

10-fold CV can only be applied to linear models, hence the repetitions.

68.

Inspect the LOOCV plot of Mean Squared Error versus Degree of Polynomial. What overall pattern is depicted across degrees 2 to 10?

a)

Error increases sharply with degree.

b)

Error drops from degree 2 and then remains relatively flat with slight variations.

c)

Error oscillates dramatically with large spikes at every degree.

d)

Error is constant across all degrees.

69.

Comparing the two plots, which statement best characterizes the variance of the estimated error between LOOCV and 10-fold CV?

a)

LOOCV shows more variability across repetitions than 10-fold CV.

b)

10-fold CV shows visible variability across runs (multiple colored lines), while LOOCV presents a single, less variable estimate per degree.

c)

Both methods display identical variability across runs.

d)

Neither method involves variability because each uses the full dataset for both training and validation.

70.

Using the comparison table structure titled "LOOCV vs k-fold CV (1

a)

LOOCV: low complexity, high bias, low variance; k-fold (1

b)

LOOCV: high computational complexity, low bias, higher variance of the estimate; k-fold (1

c)

LOOCV: low computational complexity, low bias, high variance; k-fold (1

d)

LOOCV and k-fold (1

71.

Suppose N is the dataset size. Which statement is consistent with the visuals about training set sizes in LOOCV versus 5-fold CV?

a)

In LOOCV, each model trains on N observations; in 5-fold CV, each model trains on N/5 observations.

b)

In LOOCV, each model trains on N−1 observations; in 5-fold CV, each model trains on roughly 4N/5 observations.

c)

In LOOCV, each model trains on N/2 observations; in 5-fold CV, each model trains on N−1 observations.

d)

Both methods train on exactly the same number of observations per model.

72.

In the gold standard workflow for model assessment, which step ensures an unbiased estimate of generalization performance?

a)

Using k-fold splits within the training data to tune hyperparameters

b)

Retraining the model on the full training data with the best-found parameters

c)

Evaluating the final model on the held-out test data that was not used in training or tuning

d)

Averaging validation scores across folds to select the highest-performing parameter set

73.

A dataset is split into training data (X_train, y_train) and test data (X_test, y_test). Which statement correctly describes the role of k-fold cross-validation in this setup?

a)

It is performed on the test data to estimate training error

b)

It is performed on the training data to find and select model parameters

c)

It is applied after final evaluation to reduce test error

d)

It replaces the need for a separate test set entirely

74.

After selecting the best hyperparameters via k-fold cross-validation on the training split, what is the next recommended step before evaluating the model?

a)

Freeze the current fold-trained model and evaluate it directly on the test data

b)

Retrain a model using only the best-performing single fold

c)

Retrain the model using the entire training dataset with the chosen parameters

d)

Combine training and test data to increase sample size and then evaluate

75.

Which practice best matches the described gold standard approach for assessing a model?

a)

Tune on all data, then evaluate using the same data to maximize accuracy

b)

Use k-fold cross-validation on the training split, retrain on full training data, and finally evaluate once on the untouched test set

c)

Skip cross-validation and select parameters based on intuition; evaluate on the training set

d)

Perform k-fold cross-validation on the test set to ensure fair parameter tuning

76.

In scikit-learn, which function is used to evaluate an estimator across cross-validation splits and return an array of scores?

a)

GridSearchCV

b)

cross_val_score

c)

cross_validate

d)

validation_curve

77.

When using cross_val_score without specifying the scoring parameter, which scoring is applied at each cross-validation iteration?

a)

Accuracy score regardless of estimator

b)

The estimator’s score method

c)

Macro F1 by default

d)

Mean squared error

78.

You run scores = cross_val_score(knn, X_trainval, y_trainval, cv=5). What is the role of the cv argument in this call?

a)

Selects the evaluation metric

b)

Sets the number of folds or the CV iterator

c)

Chooses the classifier

d)

Enables probability estimates

79.

According to the default behavior described, when cv is an integer and the estimator is a classifier with binary or multiclass y, which CV strategy is used?

a)

KFold

b)

LeaveOneOut

c)

StratifiedKFold

d)

RepeatedKFold

80.

Which parameter of cross_val_score allows you to choose a specific evaluation metric such as macro F1?

a)

groups

b)

params

c)

scoring

d)

n_jobs

81.

In the function signature sklearn.model_selection.cross_val_score(estimator, X, y=None, *, groups=None, scoring=None, cv=None, n_jobs=None, verbose=0, params=None, pre_dispatch='2*n_jobs', error_score=nan), what do X and y represent?

a)

Model hyperparameters and labels

b)

Data features and target variable

c)

Training indices and test indices

d)

Group labels and scores

82.

Which statement correctly describes the groups parameter in cross_val_score?

a)

It sets class weights for imbalanced data.

b)

It passes additional fit parameters to the estimator.

c)

It provides group labels used when splitting with a Group CV instance.

d)

It determines the number of parallel jobs.

83.

If cv is an integer and the task is regression, which default CV splitter is used according to the material?

a)

StratifiedKFold

b)

KFold

c)

GroupKFold

d)

ShuffleSplit

84.

Suppose you compute scores = cross_val_score(knn, X_trainval, y_trainval, cv=5) and obtain an array of five values. Which summary appropriately reports performance as shown in the example?

a)

Report the max score only.

b)

Print the median score without variability.

c)

Print mean accuracy with the standard deviation of scores.

d)

Report the training score of the final fit.

85.

In the worked example, a loop evaluates KNeighborsClassifier over different n_neighbors using cross_val_score with cv=10. What is the purpose of taking np.mean(scores) for each i?

a)

To select the best distance metric

b)

To aggregate fold-wise scores into a single value for that n_neighbors

c)

To average training losses

d)

To compute macro-averaged precision

86.

Which parameter controls parallel execution across folds in cross_val_score?

a)

verbose

b)

n_jobs

c)

pre_dispatch

d)

error_score

87.

In the example, after selecting best_n_neighbors from cross-validation, the model is fit on X_train, y_train and evaluated on X_test, y_test. What is the rationale for this sequence?

a)

Cross-validation directly optimizes test performance without refitting.

b)

Refitting on the full training data with the selected hyperparameter allows unbiased evaluation on the held-out test set.

c)

The test set is used to tune hyperparameters.

d)

Cross-validation is only intended for regression, so classification requires refitting.

88.

In scikit-learn, which iterator splits the dataset into k consecutive folds without stratification or grouping constraints?

a)

KFold

b)

StratifiedKFold

c)

GroupKFold

d)

TimeSeriesSplit

89.

Which cross-validation strategy ensures that the same group is not represented in both training and testing sets within an iteration?

a)

ShuffleSplit

b)

GroupKFold

c)

StratifiedKFold

d)

TimeSeriesSplit

90.

Consider binary classification with imbalanced classes. Which iterator is designed to preserve the percentage of samples for each class across folds?

a)

KFold

b)

StratifiedKFold

c)

GroupShuffleSplit

d)

ShuffleSplit

91.

Which iterator is described as a random permutation cross-validator that generates random train/test splits without preserving class proportions or groups by default?

a)

ShuffleSplit

b)

KFold

c)

StratifiedGroupKFold

d)

TimeSeriesSplit

92.

Which iterator is suited for temporal data by creating splits that respect ordering (training on earlier indices and testing on later indices)?

a)

TimeSeriesSplit

b)

GroupKFold

c)

StratifiedShuffleSplit

d)

KFold

93.

A dataset has 100 input data points, 3 classes split unevenly across points, and 10 groups split evenly. Which iterator simultaneously enforces class stratification and prevents group overlap between train and test?

a)

StratifiedKFold

b)

GroupKFold

c)

StratifiedGroupKFold

d)

ShuffleSplit

94.

According to the API shown, what does sklearn.model_selection.ShuffleSplit primarily do?

a)

Split arrays or matrices into random train and test subsets

b)

Create k consecutive equal-sized folds based on index order

c)

Maintain class proportions exactly equal across all folds

d)

Ensure no group appears in both train and test sets

95.

The Iris dataset contains three species with 50 samples each. Which statement best describes their separability based on the provided summary?

a)

All three species are linearly separable from each other.

b)

One species is linearly separable from the other two, while those two are not linearly separable from each other.

c)

None of the species is linearly separable from any other.

d)

Exactly two species are linearly separable from each other and the third is inseparable from both.

96.

According to the features listed for the Iris dataset, which variable is NOT among the four features used?

a)

SepalLengthCm

b)

PetalWidthCm

c)

LeafAreaCm

d)

SepalWidthCm

97.

A code snippet shows using KFold with n_splits=3 on the Iris dataset and yields very low accuracy. Based on the section’s explanation, which scenario most likely causes this poor result?

a)

Using too many features increases overfitting.

b)

The dataset is sorted by class labels, so standard KFold can place entire classes in separate folds, making some test folds contain unseen classes.

c)

The Iris dataset has missing values that KFold cannot handle.

d)

KFold always performs worse than train/test split regardless of data ordering.

98.

What is the primary purpose of StratifiedKFold as contrasted with standard KFold in the context discussed?

a)

To reduce the number of folds needed for cross-validation.

b)

To ensure each fold has class proportions that mirror the overall dataset, preventing folds that miss some classes.

c)

To increase the training data size by duplicating samples.

d)

To randomize feature order for each split.

99.

When your dataset is highly imbalanced, why is StratifiedKFold recommended?

a)

It oversamples the minority class within each fold to achieve perfect balance.

b)

It guarantees that minority classes appear in each fold according to their overall frequency, reducing the chance that a class is missing from a fold.

c)

It removes rare classes before splitting to stabilize accuracy.

d)

It merges minority classes to simplify classification.

100.

If the data are sorted by class and you apply standard (non-stratified) KFold, what accuracy outcome is highlighted in the material?

a)

Accuracy will be optimal because classes are isolated.

b)

Accuracy will be zero because some folds test on classes not present in their training data.

c)

Accuracy will be unchanged because sorting has no effect.

d)

Accuracy will be random and vary widely but remain positive.

101.

Which statement about class frequencies under StratifiedKFold is correct according to the section?

a)

Relative class frequencies in each fold are forced to be exactly equal across classes.

b)

Relative class frequencies in each fold reflect the relative class frequencies in the entire dataset.

c)

Class frequencies are ignored because StratifiedKFold only randomizes indices.

d)

Class frequencies are matched only in the training parts, not in the test parts.