Unit 2: Classification with scikit-learn - Practice Quiz

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

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

A. The target variable is continuous.
B. The input variables are continuous.
C. The target variable is categorical or discrete.
D. The training data is unlabeled.

2 Which scikit-learn method is primarily used to train a classifier on a dataset ?

A. model.predict(X, y)
B. model.score(X, y)
C. model.fit(X, y)
D. model.transform(X, y)

3 What is the standard shape of the input matrix expected by scikit-learn classifiers?

A. (n_features, n_samples)
B. (n_features, n_classes)
C. (n_samples, n_features)
D. (n_samples, n_samples)

4 Which of the following metrics is defined as the ratio of correctly predicted observations to the total observations?

A. Accuracy
B. Recall
C. Precision
D. F1-Score

5 In a Confusion Matrix, what does a False Positive (FP) represent?

A. The model predicted Positive, and the actual class was Positive.
B. The model predicted Negative, and the actual class was Positive.
C. The model predicted Positive, but the actual class was Negative.
D. The model predicted Negative, and the actual class was Negative.

6 Which metric is best suited for a classification problem where False Negatives are much more costly than False Positives (e.g., detecting a deadly disease)?

A. Recall
B. Specificity
C. Precision
D. Accuracy

7 Calculate the Precision given: , , .

A. 0.20
B. 0.91
C. 0.50
D. 0.83

8 The F1-Score is the harmonic mean of which two metrics?

A. Accuracy and Recall
B. Specificity and Sensitivity
C. Precision and Recall
D. TPR and FPR

9 In an ROC curve, the x-axis and y-axis represent which metrics respectively?

A. True Negative Rate vs True Positive Rate
B. False Positive Rate vs True Positive Rate
C. Recall vs Accuracy
D. Precision vs Recall

10 What does an AUC (Area Under Curve) score of 0.5 imply about a classifier?

A. It performs no better than random guessing.
B. It predicts the negative class always.
C. It has zero errors.
D. It is a perfect classifier.

11 When using classification_report in scikit-learn, what does the macro avg represent?

A. The accuracy of the model.
B. The standard deviation of the metric.
C. The weighted average based on support size.
D. The unweighted mean of the metric for each label.

12 Which issue makes Accuracy a misleading metric?

A. High computational cost.
B. It cannot be calculated for multiclass problems.
C. Imbalanced datasets.
D. Linearly separable data.

13 What is the activation function used in the standard Perceptron algorithm for binary classification?

A. ReLU function
B. Tanh function
C. Sigmoid function
D. Heaviside step function

14 The Perceptron algorithm is guaranteed to converge only if:

A. The data is normally distributed.
B. The learning rate is greater than 1.
C. The weights are initialized to zero.
D. The data is linearly separable.

15 Which function maps the output of a linear equation to a probability value in in Logistic Regression?

A. Step
B. Sigmoid (Logistic)
C. Logarithm
D. Softmax

16 The decision boundary generated by a standard Logistic Regression model is:

A. Polynomial
B. Irregular
C. Circular
D. Linear

17 In scikit-learn's LogisticRegression, what is the purpose of the parameter C?

A. It controls the learning rate.
B. It is the inverse of regularization strength.
C. It determines the kernel type.
D. It sets the number of iterations.

18 Which loss function is minimized in Logistic Regression?

A. Hinge Loss
B. Mean Squared Error
C. Gini Impurity
D. Log Loss (Cross-Entropy)

19 How does k-Nearest Neighbors (k-NN) classify a new data point?

A. By projecting the point onto a hyperplane.
B. By finding the best splitting feature.
C. By taking a majority vote of the closest training examples.
D. By calculating the probability using Bayes' theorem.

20 Why is k-NN often referred to as a lazy learner?

A. It ignores outliers.
B. It uses a simple distance metric.
C. It trains very slowly.
D. It only generalizes the data during the prediction phase.

21 In k-NN, what is the effect of choosing a very small value for (e.g., )?

A. Low Bias, High Variance (Overfitting)
B. High Bias, Low Variance (Underfitting)
C. The decision boundary becomes smooth.
D. The model becomes a linear classifier.

22 Which preprocessing step is critical for k-NN performance?

A. Increasing the number of features
B. Removing correlations
C. One-hot encoding target labels
D. Feature Scaling

23 Which distance metric is calculated as ?

A. Euclidean Distance
B. Minkowski Distance
C. Cosine Similarity
D. Manhattan Distance

24 In a Decision Tree, what does a leaf node represent?

A. The root of the tree.
B. A feature to split on.
C. A decision rule.
D. A class label or probability.

25 Which metric does the CART algorithm (used by scikit-learn for Decision Trees) use by default to measure impurity?

A. Gini Impurity
B. Log Loss
C. Entropy
D. Mean Squared Error

26 Calculate the Gini Impurity of a node containing 3 positive samples and 3 negative samples.

A. 1.0
B. 0.0
C. 0.25
D. 0.5

27 Which hyperparameter in DecisionTreeClassifier can be used to control overfitting?

A. learning_rate
B. C
C. max_depth
D. kernel

28 What is the concept of Information Gain in Decision Trees?

A. The total number of nodes in the tree.
B. The reduction in entropy (or impurity) achieved by a split.
C. The increase in accuracy after a split.
D. The time taken to train the tree.

29 Decision Trees split the feature space into regions using boundaries that are:

A. Orthogonal to the feature axes
B. Curved
C. Circular
D. Diagonal

30 The primary objective of a Support Vector Machine (SVM) is to find a hyperplane that:

A. Passes through the mean of the data.
B. Maximizes the margin between classes.
C. Separates data with zero error regardless of margin.
D. Minimizes the number of support vectors.

31 What are Support Vectors in SVM?

A. The centroids of the classes.
B. The data points closest to the decision boundary.
C. The data points furthest from the decision boundary.
D. The misclassified data points.

32 Which technique allows SVM to perform non-linear classification?

A. The Kernel Trick
B. Gradient Descent
C. Bagging
D. Pruning

33 In SVC (Support Vector Classifier), what does a high value of Gamma () imply for an RBF kernel?

A. The decision boundary will be nearly linear.
B. The model fits the training data very closely (potential overfitting).
C. Each training example has a wide-reaching influence.
D. The margin becomes wider.

34 Which scikit-learn class is used for Support Vector Classification?

A. sklearn.linear_model.SGDClassifier
B. sklearn.tree.DecisionTreeClassifier
C. sklearn.svm.SVR
D. sklearn.svm.SVC

35 The Naïve Bayes classifier is based on which statistical theorem?

A. Gauss-Markov Theorem
B. Bayes' Theorem
C. Central Limit Theorem
D. Pythagorean Theorem

36 What is the "Naïve" assumption in Naïve Bayes?

A. All features are equally important.
B. All features are mutually independent given the class.
C. The classes are balanced.
D. The data follows a normal distribution.

37 Which variant of Naïve Bayes is best suited for continuous data assuming a bell-curve distribution?

A. MultinomialNB
B. ComplementNB
C. GaussianNB
D. BernoulliNB

38 In Text Classification with word counts, which Naïve Bayes variant is typically used?

A. LinearNB
B. MultinomialNB
C. LogisticNB
D. GaussianNB

39 What is Laplace Smoothing used for in Naïve Bayes?

A. To normalize the dataset.
B. To prevent zero probabilities for unseen features.
C. To reduce the number of features.
D. To handle continuous variables.

40 Which of the following classifiers is a Generative Model?

A. Decision Tree
B. Support Vector Machine
C. Logistic Regression
D. Naïve Bayes

41 To handle a multi-class classification problem with a binary classifier like Logistic Regression, which strategy is commonly used?

A. Gradient Boosting
B. Pruning
C. Kernel Trick
D. One-vs-Rest (OvR)

42 Which metric is calculated using the formula: ?

A. Accuracy
B. F1-Score
C. Specificity
D. Matthews Correlation Coefficient

43 If a Decision Tree is fully grown until all leaves are pure, it is likely to have:

A. High Variance (Overfitting)
B. Low Variance
C. Low Accuracy on training data
D. High Bias

44 In the context of the Confusion Matrix, Specificity is also known as:

A. Precision
B. False Positive Rate
C. True Negative Rate
D. True Positive Rate

45 Which scikit-learn utility is best used to split data into training and testing sets?

A. cross_val_score
B. GridSearchCV
C. StandardScaler
D. train_test_split

46 What happens to the decision boundary of a Logistic Regression model if the regularization parameter is very small?

A. The model overfits.
B. The model underfits (high bias).
C. The boundary becomes non-linear.
D. The coefficients become large.

47 Which of the following algorithms does NOT produce a linear decision boundary (without kernels)?

A. Logistic Regression
B. k-Nearest Neighbors
C. Linear SVM
D. Linear Perceptron

48 In SVM, which kernel is defined as ?

A. RBF Kernel
B. Linear Kernel
C. Sigmoid Kernel
D. Polynomial Kernel

49 What is the primary advantage of Naïve Bayes classifiers regarding training time?

A. They are fast because they require a single pass over the data.
B. They depend on the number of support vectors.
C. They are very slow due to iterative optimization.
D. They are slow because they calculate distances between all points.