Unit 4: Regression with scikit-Learn - Practice Quiz

INT395 — Supervised Learning 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 In the context of supervised learning, what distinguishes a regression problem from a classification problem?

A. The target variable is continuous.
B. The input features must be categorical.
C. Regression requires unsupervised data.
D. The target variable is categorical.

2 Which visualization tool is most commonly used in Exploratory Data Analysis (EDA) to visualize the linear relationship between a single feature and the target variable?

A. Pie chart
B. Box plot
C. Histogram
D. Scatter plot

3 When analyzing the relationship between multiple variables in a dataset, which matrix helps quantify the linear correlation between every pair of features?

A. Hessian matrix
B. Correlation matrix
C. Confusion matrix
D. Covariance matrix

4 In a simple linear regression model , what does represent?

A. The y-intercept
B. The slope of the line
C. The residual error
D. The learning rate

5 Which Scikit-Learn class is used to perform Ordinary Least Squares (OLS) linear regression?

A. sklearn.linear_model.Ridge
B. sklearn.linear_model.LinearRegression
C. sklearn.linear_model.SGDRegressor
D. sklearn.linear_model.Lasso

6 What is the objective function that Ordinary Least Squares (OLS) minimizes?

A. Mean Absolute Error (MAE)
B. Sum of Squared Errors (SSE)
C. Cross-Entropy Loss
D. Hinge Loss

7 What is the primary motivation for using the RANSAC (RANdom SAmple Consensus) algorithm in regression?

A. To fit a model in the presence of a significant number of outliers.
B. To handle missing values automatically.
C. To increase the speed of training.
D. To perform feature selection.

8 In the RANSAC algorithm, what does the 'residual_threshold' parameter define?

A. The minimum number of samples required to fit the model.
B. The maximum residual for a data sample to be classified as an inlier.
C. The learning rate of the estimator.
D. The maximum number of iterations.

9 Which metric is calculated as ?

A. Coefficient of Determination
B. Mean Absolute Error
C. Explained Variance Score
D. Mean Squared Error

10 If an score is 1.0, what does this indicate about the regression model?

A. The model perfectly fits the data.
B. The model explains none of the variability of the response data.
C. The model is a constant line.
D. The model is underfitting.

11 Why is Mean Squared Error (MSE) often preferred over Mean Absolute Error (MAE) for optimization?

A. MSE is always smaller than MAE.
B. MSE is differentiable everywhere, making gradient-based optimization easier.
C. MSE has the same unit as the target variable.
D. MSE is robust to outliers.

12 To perform Polynomial Regression using a linear model in Scikit-Learn, which transformer must be applied first?

A. PolynomialFeatures
B. StandardScaler
C. OneHotEncoder
D. SimpleImputer

13 What is the main risk associated with using a high-degree polynomial in regression?

A. Convergence failure
B. Underfitting
C. High bias
D. Overfitting

14 Which of the following techniques helps reduce overfitting in regression models by adding a penalty term to the loss function?

A. Normalization
B. Regularization
C. Augmentation
D. Standardization

15 Ridge regression minimizes the sum of squared residuals plus a penalty term based on:

A. The sum of squared values of coefficients ( norm).
B. The number of non-zero coefficients.
C. The sum of absolute values of coefficients ( norm).
D. The maximum coefficient value.

16 Which property makes Lasso regression useful for feature selection?

A. It shrinks coefficients uniformly.
B. It forces some coefficients to become exactly zero.
C. It increases the magnitude of coefficients.
D. It works best when .

17 In Scikit-Learn, which regression model combines both and regularization penalties?

A. ElasticNet
B. Lasso
C. Ridge
D. BayesianRidge

18 In regularized regression, what is the role of the hyperparameter (or )?

A. It controls the strength of the regularization penalty.
B. It controls the learning rate.
C. It determines the degree of the polynomial.
D. It sets the intercept to zero.

19 Why is feature scaling (e.g., Standardization) important before applying Ridge or Lasso regression?

A. To ensure the target variable is normally distributed.
B. To convert categorical data to numeric.
C. To remove missing values.
D. Because the penalty term is sensitive to the scale of the coefficients.

20 Support Vector Regression (SVR) tries to fit as many data points as possible within a margin of width:

A. Zero
B. (epsilon)
C.
D.

21 In Support Vector Regression, what is the role of the kernel function?

A. To select the best features.
B. To normalize the target variable.
C. To calculate the error metric.
D. To map the input data into a higher-dimensional feature space to handle non-linearity.

22 Which parameter in SVR controls the trade-off between the smoothness of the decision function and the tolerance for training errors?

A. C
B. Degree
C. Gamma
D. Kernel

23 What is the primary criterion used by Decision Tree Regressors to split a node?

A. Information Gain
B. Log-Loss
C. Gini Impurity
D. MSE (Variance reduction)

24 One major advantage of Decision Tree Regression is:

A. It always extrapolates well.
B. It does not require feature scaling or normalization.
C. It never overfits.
D. It creates smooth, continuous prediction curves.

25 What is a characteristic behavior of a Decision Tree Regressor when predicting values outside the range of the training data?

A. It returns a null value.
B. It predicts the average of the closest training samples (constant prediction).
C. It automatically creates a polynomial fit.
D. It extrapolates linearly.

26 Random Forest Regression improves upon a single Decision Tree by utilizing which technique?

A. Pruning
B. Bagging (Bootstrap Aggregating)
C. Kernel trick
D. Gradient Boosting

27 In a Random Forest Regressor, how is the final prediction determined?

A. Weighted sum of the features.
B. Average of the predictions of all individual trees.
C. The prediction of the tree with the highest accuracy.
D. Majority vote of the trees.

28 Which parameter in RandomForestRegressor determines the number of trees in the forest?

A. min_samples_split
B. n_estimators
C. max_depth
D. bootstrap

29 Random Forests introduce randomness in two ways: bootstrap sampling and:

A. Randomly pruning the trees.
B. Random initialization of weights.
C. Randomly shuffling the target labels.
D. Selecting a random subset of features at each split.

30 What is the 'Out-of-Bag' (OOB) score in Random Forests?

A. A validation score calculated using the samples not included in the bootstrap sample for each tree.
B. The error rate of the worst tree.
C. The training error of the full ensemble.
D. The accuracy on the test set.

31 Which Scikit-Learn function splits a dataset into training and testing sets?

A. sklearn.model_selection.cross_val_score
B. sklearn.preprocessing.train_test
C. sklearn.metrics.split_data
D. sklearn.model_selection.train_test_split

32 In the equation for ElasticNet: , what does (or l1_ratio in scikit-learn) control?

A. The mix between Ridge and Lasso regularization.
B. The degree of the polynomial.
C. The tolerance for stopping criteria.
D. The overall regularization strength.

33 A residual plot shows the residuals on the y-axis and the predicted values on the x-axis. What pattern indicates a good regression model?

A. A linear trend.
B. A clear U-shape curve.
C. A funnel shape (heteroscedasticity).
D. Points randomly scattered around the horizontal axis (zero).

34 When using SGDRegressor from Scikit-Learn, which hyperparameter defines the update rule schedule (how the learning rate changes over time)?

A. penalty
B. loss
C. learning_rate
D. alpha

35 Which of the following is an intrinsic weakness of Linear Regression?

A. It cannot model non-linear relationships without feature engineering.
B. It is computationally expensive.
C. It is difficult to interpret.
D. It requires categorical features.

36 In the context of regression metrics, what does Median Absolute Error provide that Mean Absolute Error does not?

A. Differentiability.
B. Squared penalization.
C. Robustness to outliers.
D. Percentage error calculation.

37 What is Multicollinearity?

A. When the model has too many polynomial features.
B. When the target variable is categorical.
C. When the training data is too small.
D. When independent features are highly correlated with each other.

38 How does DecisionTreeRegressor handle missing values in Scikit-Learn (standard implementation)?

A. It treats them as a separate category.
B. It handles them natively.
C. It requires imputation (filling missing values) before training.
D. It ignores the rows with missing values.

39 Which plot is typically used to inspect if the residuals follow a normal distribution?

A. Bar chart
B. Box plot
C. Scatter plot
D. Q-Q (Quantile-Quantile) plot

40 In Polynomial Regression, if you increase the degree of the polynomial significantly, the model becomes:

A. Linear.
B. Less flexible.
C. More complex with higher variance.
D. More biased.

41 What is the result of applying fit_transform on the training data and then transform on the test data during scaling?

A. Data leakage.
B. Overfitting.
C. Incorrect scaling.
D. Correct application of preprocessing parameters learnt from training to test data.

42 Which Scikit-Learn attribute holds the estimated coefficients for a Linear Regression model after fitting?

A. model.weights_
B. model.params_
C. model.coef_
D. model.intercept_

43 What is the analytical solution to find the optimal weights for Linear Regression called?

A. The Normal Equation
B. Coordinate Descent
C. Backpropagation
D. Gradient Descent

44 When using Support Vector Regression with an RBF kernel, what happens if the parameter (gamma) is very large?

A. The model behaves like a linear regression.
B. The influence of each training example is limited to a close radius, leading to overfitting.
C. The influence of each training example reaches very far.
D. The model becomes a flat line.

45 Why might one use Adjusted instead of standard ?

A. To account for the number of predictors, penalizing the addition of useless features.
B. To handle categorical variables.
C. To calculate error in absolute terms.
D. To ensure the score is always positive.

46 In the context of Bias-Variance tradeoff, a simple linear model with few features typically has:

A. Low Bias and Low Variance
B. Low Bias and High Variance
C. High Bias and Low Variance
D. High Bias and High Variance

47 Which of the following creates a pipeline in Scikit-Learn that scales data then fits a regressor?

A. sklearn.compose.ColumnTransformer()
B. sklearn.pipeline.make_pipeline(StandardScaler(), LinearRegression())
C. sklearn.linear_model.LinearRegression(normalize=True)
D. sklearn.model_selection.cross_val_score(LinearRegression())

48 What is the interpretation of the slope coefficient in the model ?

A. The value of when .
B. The correlation between and .
C. The change in for a one-unit increase in .
D. The percentage change in .

49 Which regression algorithm constructs a model based on the principle of 'recursive binary splitting'?

A. Linear Regression
B. Decision Tree Regression
C. Ridge Regression
D. Support Vector Regression

50 When interpreting a heatmap of a correlation matrix, a value of -0.9 between two features indicates:

A. No linear relationship.
B. A strong negative linear relationship.
C. A strong positive linear relationship.
D. A weak negative linear relationship.