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. The target variable is categorical.
D. Regression requires unsupervised data.

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. Box plot
B. Pie chart
C. Scatter plot
D. Histogram

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

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

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

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

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

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

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

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

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

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

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

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

9 Which metric is calculated as ?

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

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

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

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

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

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

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

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

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

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

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

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

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

16 Which property makes Lasso regression useful for feature selection?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

24 One major advantage of Decision Tree Regression is:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 clear U-shape curve.
B. A linear trend.
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. learning_rate
B. loss
C. alpha
D. penalty

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

A. It is difficult to interpret.
B. It is computationally expensive.
C. It cannot model non-linear relationships without feature engineering.
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. Robustness to outliers.
B. Percentage error calculation.
C. Squared penalization.
D. Differentiability.

37 What is Multicollinearity?

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

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

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

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

A. Box plot
B. Bar chart
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. More biased.
B. Linear.
C. More complex with higher variance.
D. Less flexible.

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

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

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

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

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

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

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 model becomes a flat line.
D. The influence of each training example reaches very far.

45 Why might one use Adjusted instead of standard ?

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

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

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

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

A. sklearn.linear_model.LinearRegression(normalize=True)
B. sklearn.compose.ColumnTransformer()
C. sklearn.model_selection.cross_val_score(LinearRegression())
D. sklearn.pipeline.make_pipeline(StandardScaler(), 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 percentage change in .
D. The change in for a one-unit increase in .

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

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

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

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