1What is the primary characteristic of supervised machine learning?
Introduction to supervised Learning
Easy
A.The algorithm's main goal is to reduce the number of features.
B.The algorithm discovers patterns in unlabeled data.
C.The algorithm learns through a system of rewards and punishments.
D.The algorithm is trained on labeled data (input-output pairs).
Correct Answer: The algorithm is trained on labeled data (input-output pairs).
Explanation:
Supervised learning is defined by its use of a dataset where each data point is tagged with a correct label or output. The algorithm learns to map inputs to outputs based on these examples.
Incorrect! Try again.
2The basic Perceptron algorithm is a model for which type of machine learning task?
Perceptron
Easy
A.Binary classification
B.Clustering
C.Dimensionality reduction
D.Regression
Correct Answer: Binary classification
Explanation:
The Perceptron is a foundational algorithm for supervised learning of binary classifiers. It's a linear classifier that makes its predictions based on a linear predictor function combining a set of weights with the feature vector.
Incorrect! Try again.
3What kind of decision boundary does a single-layer Perceptron create?
Perceptron
Easy
A.A linear decision boundary
B.A probabilistic decision boundary
C.A circular decision boundary
D.A non-linear decision boundary
Correct Answer: A linear decision boundary
Explanation:
A single-layer Perceptron can only learn linearly separable patterns, meaning it separates the data points with a straight line (in 2D) or a hyperplane (in higher dimensions).
Incorrect! Try again.
4Despite its name, Logistic Regression is primarily used for what kind of problem?
Logistic Regression
Easy
A.Clustering
B.Association rule learning
C.Classification
D.Regression
Correct Answer: Classification
Explanation:
Logistic Regression is a classification algorithm. It models the probability that a given input point belongs to a certain class, making it suitable for tasks like spam detection or medical diagnosis.
Incorrect! Try again.
5Which function is used in Logistic Regression to map a real-valued number to a probability between 0 and 1?
Logistic Regression
Easy
A.Step function
B.Sigmoid function
C.Linear function
D.ReLU function
Correct Answer: Sigmoid function
Explanation:
The Sigmoid (or logistic) function, which has an 'S' shape, is used to squash the output of the linear model into the range [0, 1], which can be interpreted as a probability.
Incorrect! Try again.
6The Naïve Bayes classifier is based on which mathematical theorem?
Naïve Bayes Classifier
Easy
A.The Law of Large Numbers
B.Pythagorean Theorem
C.Bayes' Theorem
D.The Central Limit Theorem
Correct Answer: Bayes' Theorem
Explanation:
The entire algorithm is a direct application of Bayes' Theorem, which describes the probability of an event based on prior knowledge of conditions that might be related to the event.
Incorrect! Try again.
7What is the key 'naïve' assumption made by the Naïve Bayes classifier?
Naïve Bayes Classifier
Easy
A.That the dataset has no missing values.
B.That the model can only handle two classes.
C.That the data follows a normal distribution.
D.That all features are independent of each other, given the class.
Correct Answer: That all features are independent of each other, given the class.
Explanation:
The 'naïve' assumption is the simplifying belief that the features are conditionally independent. This assumption makes the computations much simpler, and despite being often incorrect in reality, the classifier works surprisingly well in practice.
Incorrect! Try again.
8In the K-Nearest Neighbors (KNN) algorithm, what does the 'K' represent?
K-Nearest Neighbors
Easy
A.The number of nearest neighbors to consider for classification.
B.The number of classes in the target variable.
C.The number of features in the dataset.
D.A constant for the learning rate.
Correct Answer: The number of nearest neighbors to consider for classification.
Explanation:
'K' is a user-defined hyperparameter that specifies how many of the closest training examples are used to determine the class of a new data point via majority voting.
Incorrect! Try again.
9KNN is often called a 'lazy learner' because:
K-Nearest Neighbors
Easy
A.It only works on small datasets.
B.It does very little work during the training phase.
C.It is computationally inexpensive during prediction.
D.It trains very slowly.
Correct Answer: It does very little work during the training phase.
Explanation:
KNN is a lazy learning (or instance-based) algorithm because it doesn't build an explicit model during training. It simply stores the entire training dataset. The actual work of calculating distances and finding neighbors is deferred until a prediction is needed.
Incorrect! Try again.
10In a classification decision tree, what does a leaf node typically represent?
Decision Tree
Easy
A.A feature to test or split on.
B.The root of the tree.
C.The entire dataset.
D.A class label or a final decision.
Correct Answer: A class label or a final decision.
Explanation:
The path from the root to a leaf represents a series of rules or tests. The leaf node itself represents the final outcome or classification for a data point that follows that path.
Incorrect! Try again.
11What is a common criterion used to decide the best feature to split on at a node in a decision tree?
Decision Tree
Easy
A.Mean Squared Error
B.P-value
C.Information Gain
D.Euclidean Distance
Correct Answer: Information Gain
Explanation:
Splitting criteria like Information Gain (based on entropy) or Gini Impurity are used to select the feature that will result in the 'purest' possible child nodes, effectively separating the classes as much as possible with that single split.
Incorrect! Try again.
12What is the primary objective of a Support Vector Machine (SVM) algorithm in classification?
Support Vector Machine
Easy
A.To find the probability of a data point belonging to a class.
B.To find the optimal hyperplane that maximally separates the classes.
C.To build a tree-like model of decisions.
D.To cluster data points into k groups.
Correct Answer: To find the optimal hyperplane that maximally separates the classes.
Explanation:
An SVM seeks to find a decision boundary (a hyperplane) that has the largest possible margin, or distance, between the data points of the different classes.
Incorrect! Try again.
13In the context of SVMs, what are the 'support vectors'?
Support Vector Machine
Easy
A.The weights assigned to the features.
B.The data points that are misclassified by the model.
C.All the data points in the training set.
D.The data points that are closest to the decision boundary (hyperplane).
Correct Answer: The data points that are closest to the decision boundary (hyperplane).
Explanation:
Support vectors are the critical data points that lie on the margin. These are the points that 'support' or define the position and orientation of the hyperplane. If any other point were removed, the hyperplane would not change.
Incorrect! Try again.
14In a confusion matrix for binary classification, what does 'True Positive' (TP) mean?
Model evaluation using confusion matrix, precision, recall, F1-Score
Easy
A.The model correctly predicted the negative class.
B.The model incorrectly predicted the negative class when it was positive.
C.The model correctly predicted the positive class.
D.The model incorrectly predicted the positive class when it was negative.
Correct Answer: The model correctly predicted the positive class.
Explanation:
A True Positive occurs when the actual class is positive, and the model's prediction is also positive. It represents a correct positive prediction.
Incorrect! Try again.
15Which evaluation metric is calculated using the formula ?
Model evaluation using confusion matrix, precision, recall, F1-Score
Easy
A.Precision
B.Accuracy
C.Recall
D.F1-Score
Correct Answer: Precision
Explanation:
Precision measures the accuracy of the positive predictions. It answers the question: 'Of all the instances that the model labeled as positive, what proportion were actually positive?'
Incorrect! Try again.
16Recall (or Sensitivity) is defined by which of the following formulas?
Model evaluation using confusion matrix, precision, recall, F1-Score
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Recall measures the model's ability to find all the actual positive samples. It answers the question: 'Of all the actual positive instances, what proportion did the model correctly identify?'
Incorrect! Try again.
17An ROC curve is a plot of the True Positive Rate against which other metric?
Model evaluation using ROC Curve, ROC-AUC
Easy
A.False Positive Rate
B.True Negative Rate
C.Precision
D.F1-Score
Correct Answer: False Positive Rate
Explanation:
The Receiver Operating Characteristic (ROC) curve plots the True Positive Rate (TPR), also known as Recall or Sensitivity, on the y-axis versus the False Positive Rate (FPR) on the x-axis for various threshold settings.
Incorrect! Try again.
18An AUC-ROC score of 1.0 for a classifier indicates that...
Model evaluation using ROC Curve, ROC-AUC
Easy
A.The classifier has high precision but low recall.
B.The classifier is always wrong.
C.The classifier is perfect.
D.The classifier is no better than random guessing.
Correct Answer: The classifier is perfect.
Explanation:
An Area Under the ROC Curve (AUC-ROC) of 1.0 means the model has a True Positive Rate of 1 and a False Positive Rate of 0, perfectly distinguishing between all positive and negative classes.
Incorrect! Try again.
19What are the two axes of a Precision-Recall Curve?
Precision-Recall Curve, AUC-PR
Easy
A.Precision and True Negative Rate
B.True Positive Rate and False Positive Rate
C.Accuracy and F1-Score
D.Precision and Recall
Correct Answer: Precision and Recall
Explanation:
A Precision-Recall (PR) curve plots Precision (y-axis) against Recall (x-axis) for different classification thresholds. It is a fundamental tool for evaluating classifiers.
Incorrect! Try again.
20A Precision-Recall curve is generally considered more informative than an ROC curve in which scenario?
Precision-Recall Curve, AUC-PR
Easy
A.When the dataset is perfectly balanced.
B.When dealing with highly imbalanced datasets.
C.When there are more than two classes.
D.When the model is linear.
Correct Answer: When dealing with highly imbalanced datasets.
Explanation:
In imbalanced datasets, the large number of true negatives can make the ROC curve look overly optimistic. The PR curve does not use true negatives in its calculations, so it provides a more accurate picture of a model's performance on the minority (positive) class.
Incorrect! Try again.
21The Perceptron learning algorithm is guaranteed to find a separating hyperplane for a binary classification problem under which specific condition?
Perceptron
Medium
A.The dataset is perfectly balanced between the two classes.
B.The data is linearly separable.
C.The learning rate is sufficiently small.
D.The features are normalized to have zero mean and unit variance.
Correct Answer: The data is linearly separable.
Explanation:
The Perceptron Convergence Theorem states that the algorithm will converge and find a separating hyperplane in a finite number of steps if and only if the training data is linearly separable. While a small learning rate and feature normalization can affect the speed and stability of convergence, they do not provide the guarantee of convergence itself.
Incorrect! Try again.
22In a logistic regression model for predicting disease (1) vs. no disease (0), the coefficient for a feature smoking_years is . How should this be interpreted?
Logistic Regression
Medium
A.For each additional year of smoking, the log-odds of having the disease decrease by 0.693.
B.For each additional year of smoking, the odds of having the disease double.
C.For each additional year of smoking, the probability of having the disease increases by 69.3%.
D.The model is invalid because the coefficient is positive.
Correct Answer: For each additional year of smoking, the odds of having the disease double.
Explanation:
In logistic regression, the coefficients represent the change in the log-odds of the outcome for a one-unit change in the predictor. The odds ratio is calculated as . In this case, . This means that for each one-unit increase in smoking_years, the odds of having the disease are multiplied by 2, i.e., they double.
Incorrect! Try again.
23The "naïve" assumption in the Naïve Bayes classifier is that all features are conditionally independent given the class. What is the primary consequence of this assumption being violated in practice?
Naïve Bayes Classifier
Medium
A.The model will always perform worse than a logistic regression model.
B.The model will fail to train and produce an error.
C.The calculated posterior probabilities may be poorly calibrated (not accurate representations of the true likelihood), but the model can still be a good classifier.
D.The decision boundary will become highly non-linear.
Correct Answer: The calculated posterior probabilities may be poorly calibrated (not accurate representations of the true likelihood), but the model can still be a good classifier.
Explanation:
Even when the conditional independence assumption is violated, Naïve Bayes can still be an effective classifier. The assumption is mainly a mathematical convenience that simplifies the computation of posterior probabilities. Violations mean the output probabilities are not reliable, but as long as the correct class gets the highest probability, the classification (the argmax) will still be correct. This is known as the model being a good 'discriminative' classifier despite being a poor 'generative' one.
Incorrect! Try again.
24A binary classifier's performance is summarized by the following confusion matrix: TP=80, FP=20, FN=40, TN=360. What is the F1-Score for the positive class?
Model evaluation using confusion matrix, precision, recall, F1-Score
Medium
25You have trained a K-Nearest Neighbors classifier. When setting the hyperparameter , the model is most likely to exhibit:
K-Nearest Neighbors
Medium
A.Low bias and high variance
B.High bias and high variance
C.Low bias and low variance
D.High bias and low variance
Correct Answer: Low bias and high variance
Explanation:
When , the model's prediction for a new point is determined solely by its single nearest neighbor in the training set. This makes the model extremely sensitive to noise and individual data points, leading to a complex and jagged decision boundary. This represents low bias (it fits the training data very closely) and high variance (it changes drastically with small changes in the training data), which is characteristic of overfitting.
Incorrect! Try again.
26For a binary classification task, if a node in a decision tree contains 40 samples of Class A and 40 samples of Class B, what is its Gini Impurity?
Decision Tree
Medium
A.0.5
B.0.0
C.1.0
D.0.25
Correct Answer: 0.5
Explanation:
Gini Impurity is calculated as , where is the probability of a sample belonging to class . In this node, the total number of samples is 80. The probability of Class A is . The probability of Class B is . \nTherefore, Gini Impurity = . This represents the maximum impurity for a binary case.
Incorrect! Try again.
27In a trained Support Vector Machine (SVM) classifier, if you remove a data point that is not a support vector, what is the expected impact on the decision boundary?
Support Vector Machine
Medium
A.The margin will become narrower.
B.The margin will become wider.
C.The decision boundary will shift significantly.
D.The decision boundary will remain unchanged.
Correct Answer: The decision boundary will remain unchanged.
Explanation:
The SVM's decision boundary and margin are determined exclusively by the support vectors—the data points that lie on the margin or are misclassified within the margin. Data points that are correctly classified and are far away from the margin (i.e., not support vectors) do not influence the model's hyperplane. Therefore, removing such a point will have no effect on the final decision boundary.
Incorrect! Try again.
28A classifier has an AUC-ROC score of 0.5. What does this score imply about the model's performance?
Model evaluation using ROC Curve, ROC-AUC
Medium
A.The classifier has no discriminative power and is equivalent to random guessing.
B.The classifier is perfect at distinguishing between the positive and negative classes.
C.The classifier is perfectly incorrect; it systematically reverses the labels.
D.The classifier has high precision but very low recall.
Correct Answer: The classifier has no discriminative power and is equivalent to random guessing.
Explanation:
The ROC curve plots the True Positive Rate (TPR) against the False Positive Rate (FPR). A model with no discriminative power will have an ROC curve that follows the diagonal line from (0,0) to (1,1), which corresponds to random guessing. The area under this diagonal line is 0.5. A score of 1.0 indicates a perfect classifier, and a score of 0.0 indicates a perfectly inverse classifier.
Incorrect! Try again.
29Under which scenario is the Precision-Recall (PR) curve a more informative evaluation metric than the ROC curve?
Precision-Recall Curve, AUC-PR
Medium
A.When the model being evaluated is a linear model.
B.When the number of features is very large.
C.When the dataset is perfectly balanced.
D.When the dataset is highly imbalanced and the positive class is the minority.
Correct Answer: When the dataset is highly imbalanced and the positive class is the minority.
Explanation:
The ROC curve's FPR (FP / (FP + TN)) can be misleading on imbalanced datasets. A huge number of true negatives (TN) can make the FPR appear very low even with a large number of false positives (FP). The PR curve, which focuses on precision (TP / (TP + FP)) and recall (TP / (TP + FN)), does not use TN. It is therefore more sensitive to changes in the number of false positives and provides a better picture of performance when the positive class is rare.
Incorrect! Try again.
30In designing a spam filter, the primary goal is to avoid filtering out important emails (false positives). Which evaluation metric should be prioritized for optimization?
Model evaluation using confusion matrix, precision, recall, F1-Score
Medium
A.Precision
B.Accuracy
C.Negative Predictive Value
D.Recall
Correct Answer: Precision
Explanation:
A false positive in a spam filter means a legitimate email ('ham') is incorrectly classified as spam. This is highly undesirable. Precision is calculated as TP / (TP + FP), where TP is spam correctly identified and FP is ham incorrectly identified as spam. Maximizing precision means minimizing the number of false positives. Recall (sensitivity) is less critical; missing a few spam emails (false negatives) is generally more acceptable than losing important emails.
Incorrect! Try again.
31A decision tree model achieves 99% accuracy on the training set but only 70% on the test set. Which of the following is the most appropriate strategy to address this issue?
Decision Tree
Medium
A.Apply pre-pruning by setting a maximum depth (max_depth) for the tree.
B.Decrease the size of the training set.
C.Increase the number of features used to train the model.
D.Switch to Gini Impurity if Entropy was used, or vice versa.
Correct Answer: Apply pre-pruning by setting a maximum depth (max_depth) for the tree.
Explanation:
The large gap between training and test accuracy is a classic sign of overfitting. The decision tree has learned the training data, including its noise, too well. Pre-pruning techniques, such as setting a max_depth or a minimum number of samples per leaf, restrict the tree's growth and complexity. This helps the model generalize better to unseen data, thus improving test set performance by reducing variance.
Incorrect! Try again.
32In a soft-margin SVM, what is the effect of increasing the regularization parameter C?
Support Vector Machine
Medium
A.It creates a narrower margin and reduces the number of margin violations (misclassifications).
B.It converts the SVM into a hard-margin classifier, regardless of the data's separability.
C.It creates a wider margin and allows for more margin violations.
D.It only affects the training speed, with no impact on the final model.
Correct Answer: It creates a narrower margin and reduces the number of margin violations (misclassifications).
Explanation:
The parameter C controls the trade-off between maximizing the margin and minimizing the classification error on the training set. A large value of C places a high penalty on misclassified examples, forcing the model to create a smaller, more complex margin that correctly classifies more training points. This can lead to overfitting. Conversely, a small C allows for a wider margin and more misclassifications.
Incorrect! Try again.
33Why is feature scaling (e.g., standardization or normalization) a critical preprocessing step for the K-Nearest Neighbors algorithm?
K-Nearest Neighbors
Medium
A.To ensure that features with larger scales do not disproportionately influence the distance calculations.
B.To convert all categorical features into a numerical format.
C.To reduce the memory footprint of the algorithm during prediction.
D.To guarantee that the algorithm converges in a finite number of steps.
Correct Answer: To ensure that features with larger scales do not disproportionately influence the distance calculations.
Explanation:
KNN relies on a distance metric (like Euclidean distance) to find the 'nearest' neighbors. If one feature has a much larger scale than others (e.g., salary in dollars vs. age in years), the distance will be almost entirely dominated by that single feature. Scaling brings all features to a comparable range, ensuring that each feature contributes more equally to the distance metric, leading to a more meaningful and robust model.
Incorrect! Try again.
34What is the primary reason for applying a logistic (sigmoid) function in logistic regression?
Logistic Regression
Medium
A.To map the linear output of the model to a probability value between 0 and 1.
B.To handle missing values in the input features.
C.To make the model robust to outliers.
D.To create a non-linear decision boundary.
Correct Answer: To map the linear output of the model to a probability value between 0 and 1.
Explanation:
Logistic regression first computes a linear combination of the input features, . This output can range from to . The sigmoid function, , is then applied to squash this output into the range [0, 1]. This transformed value can be interpreted as the probability of the positive class, which is essential for binary classification.
Incorrect! Try again.
35You are building a Naïve Bayes classifier for text classification and encounter a word in your test data that was not present in the training data. Without any smoothing technique, what will be the posterior probability for any class?
Naïve Bayes Classifier
Medium
A.The model will ignore that word in its calculation.
B.The model will assign a very small, non-zero probability.
C.The posterior probability will be zero.
D.The posterior probability will be 0.5.
Correct Answer: The posterior probability will be zero.
Explanation:
The posterior probability calculation involves multiplying several conditional probabilities, including . If a word never appeared in the training data for any class, its conditional probability will be 0. Since the overall calculation is a product of these probabilities, the entire posterior probability for every class will become zero, making classification impossible. This is known as the 'zero-frequency problem,' which is solved by smoothing techniques like Laplace (add-one) smoothing.
Incorrect! Try again.
36Two models are evaluated on the same dataset. Model A's ROC curve is strictly above Model B's ROC curve for all thresholds. What can be definitively concluded?
Model evaluation using ROC Curve, ROC-AUC
Medium
A.Model A has higher accuracy than Model B.
B.Model A is computationally more complex than Model B.
C.Model A dominates Model B, meaning it is a better classifier across all trade-offs between TPR and FPR.
D.Model A will also have a higher AUC-PR score than Model B.
Correct Answer: Model A dominates Model B, meaning it is a better classifier across all trade-offs between TPR and FPR.
Explanation:
If one model's ROC curve is consistently above another's, it means that for any given False Positive Rate (FPR), Model A achieves a higher True Positive Rate (TPR). This indicates that Model A is unambiguously better at discriminating between the classes. This will also result in a higher AUC-ROC for Model A. While it often correlates with higher accuracy and AUC-PR, it's not a mathematical guarantee for all possible thresholds or dataset imbalances.
Incorrect! Try again.
37Which of the following tasks is NOT an example of supervised learning?
Introduction to supervised Learning
Medium
A.Grouping a store's customers into different market segments based on their purchasing history.
B.Identifying whether a handwritten digit is a '7' or a '9' based on a labeled dataset of images.
C.Predicting whether a bank loan application will be approved or denied based on historical data.
D.Estimating the sale price of a house based on features like area, location, and number of bedrooms.
Correct Answer: Grouping a store's customers into different market segments based on their purchasing history.
Explanation:
Supervised learning requires labeled data—that is, data with a known outcome or target variable. Predicting loan approval, estimating house prices, and identifying handwritten digits are all supervised tasks (classification and regression). Grouping customers into segments without pre-defined labels is an example of unsupervised learning, specifically clustering, where the goal is to discover inherent patterns or structures in the data.
Incorrect! Try again.
38Which of the following classification algorithms inherently creates a non-linear decision boundary without requiring kernel tricks or explicit feature engineering?
Nonlinear & Distance-Based Models
Medium
A.Linear SVM
B.Logistic Regression
C.Perceptron
D.Decision Tree
Correct Answer: Decision Tree
Explanation:
Decision Trees partition the feature space into a set of hyper-rectangles using a series of axis-aligned splits. The resulting decision boundary is composed of these rectangular regions, which is inherently non-linear (also called a piecewise linear boundary). In contrast, Perceptron, Logistic Regression, and Linear SVM all create linear decision boundaries by default.
Incorrect! Try again.
39On a Precision-Recall plot for a binary classification task with 20% positive instances, what does the no-skill or random baseline look like?
Precision-Recall Curve, AUC-PR
Medium
A.A diagonal line from (0,1) to (1,0)
B.A diagonal line from (0,0) to (1,1)
C.A horizontal line at Precision = 0.20
D.A horizontal line at Precision = 0.50
Correct Answer: A horizontal line at Precision = 0.20
Explanation:
The baseline for a Precision-Recall curve represents the performance of a 'no-skill' classifier that guesses randomly. Such a classifier would have a precision equal to the proportion of positive instances in the dataset, regardless of the recall value. Therefore, for a dataset with 20% positive instances, the baseline is a horizontal line at a precision level of 0.2.
Incorrect! Try again.
40The F1-Score is defined as the harmonic mean of precision and recall. Why is the harmonic mean used instead of a simple arithmetic mean?
Model evaluation using confusion matrix, precision, recall, F1-Score
Medium
A.It gives more weight to precision than to recall.
B.It gives a larger penalty to models when either precision or recall is very low.
C.It is only valid for perfectly balanced datasets.
D.It is computationally simpler than the arithmetic mean.
Correct Answer: It gives a larger penalty to models when either precision or recall is very low.
Explanation:
The harmonic mean has a property of being closer to the smaller of the two numbers. This means that for the F1-score to be high, both precision and recall must be high. If one of the metrics is very low (e.g., Precision=1.0, Recall=0.1), the F1-score will be pulled down significantly (F1 ≈ 0.18), whereas a simple average would be misleadingly high (0.55). This property makes the F1-score a more robust measure for balancing the precision-recall trade-off.
Incorrect! Try again.
41In a Support Vector Machine (SVM) with a Radial Basis Function (RBF) kernel, , what is the effect of decreasing the hyperparameter significantly (e.g., from 1.0 to 0.001), while keeping the regularization parameter constant?
Support Vector Machine
Hard
A.The model becomes completely insensitive to the regularization parameter C.
B.The decision boundary becomes smoother and closer to a linear boundary, increasing model bias.
C.The decision boundary becomes more complex and wiggly, leading to a higher risk of overfitting.
D.The number of support vectors will decrease drastically, regardless of the value of C.
Correct Answer: The decision boundary becomes smoother and closer to a linear boundary, increasing model bias.
Explanation:
The parameter in the RBF kernel defines the influence of a single training example. A small means a large radius of influence, so the model is influenced by points that are far away. This results in a smoother, less complex decision boundary, which is less likely to overfit but may have higher bias. Conversely, a large leads to a more complex boundary that is more sensitive to individual data points, increasing the risk of overfitting. Decreasing makes the model behave more like a linear SVM.
Incorrect! Try again.
42You are training a logistic regression model for a binary classification problem. During training, you observe that the weights are growing extremely large, and the algorithm fails to converge. The training data, when plotted, shows that the two classes are perfectly separable by a hyperplane. What is this phenomenon called, and what is the direct consequence?
Logistic Regression
Hard
A.Multicollinearity; the model will have high variance and unstable coefficient estimates.
B.The Hauck-Donner effect; the standard errors of the coefficients become infinitely large, making significance testing impossible.
C.Complete separation; the maximum likelihood estimate for the weights does not exist because the sigmoid function approaches its asymptotes (0 and 1) but never reaches them.
D.Underfitting; the model is too simple to capture the data, causing the optimization to diverge.
Correct Answer: Complete separation; the maximum likelihood estimate for the weights does not exist because the sigmoid function approaches its asymptotes (0 and 1) but never reaches them.
Explanation:
This phenomenon is known as complete or perfect separation. In this case, the likelihood function does not have a maximum. To perfectly classify the training data, the model tries to make the predicted probabilities for each class exactly 0 or 1. To achieve this, the input to the sigmoid function, , must go to or , which requires the weights to grow infinitely large. Regularization (L1 or L2) is the standard solution to this problem by adding a penalty term that prevents the weights from becoming too large.
Incorrect! Try again.
43You are comparing two models, Model A and Model B, on a binary classification task. You plot their ROC curves. The curves cross each other: Model A has a higher True Positive Rate (TPR) at low False Positive Rates (FPR), while Model B has a higher TPR at high FPRs. Their overall AUC-ROC scores are nearly identical (e.g., 0.85). Which statement is the most accurate for selecting a model?
Model evaluation using ROC Curve, ROC-AUC
Hard
A.Model B is fundamentally better because it achieves a higher overall recall across a wider range of thresholds.
B.Since the AUC-ROC is the same, both models are equally good and can be used interchangeably.
C.Model A should be preferred if the cost of false positives is very high and we need a classifier with high precision at the top ranks.
D.The crossing of ROC curves indicates that both models are unstable and a different algorithm should be chosen.
Correct Answer: Model A should be preferred if the cost of false positives is very high and we need a classifier with high precision at the top ranks.
Explanation:
When ROC curves cross, it means that neither model is universally better than the other across all possible classification thresholds. The choice depends on the specific application requirements. Model A performs better on the left side of the ROC plot (low FPR), which is the region of interest for applications where false positives are very costly (e.g., spam filtering, medical diagnosis where a false alarm leads to expensive procedures). This region corresponds to high-specificity, high-precision operating points. Model B would be better if maximizing the true positive rate is critical, even at the cost of accepting more false positives.
Incorrect! Try again.
44In a text classification task using a Multinomial Naïve Bayes classifier, you notice that the model's predicted probabilities are poorly calibrated; they tend to be extreme (very close to 0 or 1). This happens even though the classification accuracy is reasonable. What is the most likely cause of this phenomenon related to the core assumption of the model?
Naïve Bayes Classifier
Hard
A.The presence of many out-of-vocabulary words in the test set, leading to zero probabilities.
B.The use of Laplace smoothing with a very large alpha value, which overly flattens the probability distributions.
C.The feature vectors are not properly normalized using TF-IDF, leading to skewed probability estimates.
D.The 'naïve' assumption of conditional independence between features (words) is strongly violated, causing the model to 'double-count' evidence.
Correct Answer: The 'naïve' assumption of conditional independence between features (words) is strongly violated, causing the model to 'double-count' evidence.
Explanation:
Naïve Bayes assumes that all features are conditionally independent given the class. In text, this is rarely true (e.g., the words 'San' and 'Francisco' are highly dependent). When features are dependent, the model multiplies their probabilities together, effectively 'double-counting' the evidence for a particular class. If several correlated words pointing to the same class appear, their multiplied probabilities can push the final posterior probability towards 0 or 1 much faster than is warranted. This leads to over-confident and poorly calibrated probability scores, even if the final classification decision (the argmax) is often correct.
Incorrect! Try again.
45Consider a binary classification task where the data is perfectly separable by a diagonal line (e.g., ). How would the structure of a standard, unpruned decision tree (like CART) trained on this data likely look, and why?
Decision Tree
Hard
A.A balanced tree with only two levels, perfectly capturing the linear relationship.
B.The tree would fail to build because it cannot handle diagonal splits.
C.A single node splitting on the feature that is more correlated with the target.
D.A very deep, complex tree with a 'stair-step' decision boundary that approximates the diagonal line.
Correct Answer: A very deep, complex tree with a 'stair-step' decision boundary that approximates the diagonal line.
Explanation:
Standard decision trees (like CART, ID3, C4.5) create axis-aligned splits. They cannot create diagonal splits. To approximate a diagonal decision boundary, the algorithm must make a series of horizontal and vertical cuts. This results in a 'stair-step' or jagged boundary. To create a fine-grained approximation of the diagonal line, the tree needs to be very deep, with many nodes each making a small refinement to the boundary. This is a classic limitation of decision trees and highlights their high variance and tendency to overfit data with non-axis-aligned structures.
Incorrect! Try again.
46You are working on a fraud detection system where only 0.1% of transactions are fraudulent (positive class). You train two classifiers. Model X has an AUC-ROC of 0.95. Model Y has an AUC-ROC of 0.90. However, the AUC-PR for Model X is 0.40, while the AUC-PR for Model Y is 0.60. Which model should you choose and why?
Model evaluation using Precision-Recall Curve, AUC-PR
Hard
A.It's impossible to decide without knowing the specific precision and recall values at the chosen operational threshold.
B.Model Y, because AUC-PR is a more informative metric than AUC-ROC on highly imbalanced datasets, and a higher AUC-PR indicates better performance in identifying the rare positive class.
C.Neither model is acceptable, as an AUC-PR of 0.60 is too low for a production system.
D.Model X, because its AUC-ROC is significantly higher, indicating better overall discrimination ability.
Correct Answer: Model Y, because AUC-PR is a more informative metric than AUC-ROC on highly imbalanced datasets, and a higher AUC-PR indicates better performance in identifying the rare positive class.
Explanation:
In highly imbalanced datasets, AUC-ROC can be misleadingly optimistic. A model can achieve a high AUC-ROC by simply correctly classifying the majority negative class, which inflates the True Negative Rate. The Precision-Recall (PR) curve does not involve True Negatives and is thus more sensitive to improvements in positive class prediction. A random classifier on this dataset would have an AUC-PR close to the class imbalance ratio (0.001). Model Y's AUC-PR of 0.60 is far superior to Model X's 0.40, indicating it is much better at identifying fraudulent transactions with reasonable precision. Therefore, for tasks like fraud detection where the positive class is rare and important, the model with the higher AUC-PR should be preferred.
Incorrect! Try again.
47The Perceptron Convergence Theorem guarantees that the Perceptron learning algorithm will find a separating hyperplane in a finite number of steps. What is a key condition for this theorem to hold, and what happens if this condition is violated?
Perceptron
Hard
A.The data must be linearly separable; if it is not, the algorithm will not converge and the weights will oscillate indefinitely.
B.The learning rate must be very small; if it's too large, the algorithm will oscillate and never converge.
C.The initial weights must be set to zero; if they are initialized randomly, convergence is not guaranteed.
D.The data must be normalized; otherwise, features with larger scales will dominate the weight updates.
Correct Answer: The data must be linearly separable; if it is not, the algorithm will not converge and the weights will oscillate indefinitely.
Explanation:
The Perceptron Convergence Theorem's central requirement is that the training data must be linearly separable. If a hyperplane that perfectly separates the classes exists, the algorithm is guaranteed to find one. However, if the data is not linearly separable, the algorithm will never find a solution that correctly classifies all points. As it corrects one misclassified point, it may misclassify another point that was previously correct. This leads to the decision boundary shifting back and forth indefinitely, and the weights will never stabilize. This is a fundamental limitation of the standard Perceptron algorithm.
Incorrect! Try again.
48Why does the performance of a K-Nearest Neighbors (KNN) classifier often degrade as the dimensionality of the feature space increases, even if the additional dimensions contain useful information? This phenomenon is often referred to as the 'Curse of Dimensionality'.
K-Nearest Neighbors
Hard
A.Standard distance metrics like Euclidean distance are not mathematically defined for spaces with more than 100 dimensions.
B.In high-dimensional spaces, the concept of 'neighborhood' becomes less meaningful because the distance to the nearest neighbor approaches the distance to the farthest neighbor.
C.The computational cost of calculating distances becomes prohibitively expensive in high dimensions.
D.High dimensionality inevitably introduces multicollinearity, which KNN is unable to handle.
Correct Answer: In high-dimensional spaces, the concept of 'neighborhood' becomes less meaningful because the distance to the nearest neighbor approaches the distance to the farthest neighbor.
Explanation:
The core issue of the curse of dimensionality for distance-based methods like KNN is that as the number of dimensions () increases, the volume of the space grows exponentially. To maintain the same density of data points, the number of required samples also needs to grow exponentially. With a fixed number of data points, the space becomes increasingly sparse. Consequently, the distance between any two points in the space becomes more uniform. The ratio of the distance to the nearest neighbor to the distance to the farthest neighbor approaches 1. This makes it difficult to distinguish between 'near' and 'far' neighbors, rendering the local neighborhood concept, which is central to KNN, unstable and less informative.
Incorrect! Try again.
49In a 3-class classification problem (Classes A, B, C), a model is evaluated. The number of samples are: A=1000, B=100, C=10. The model's performance is reported with a 'micro-averaged F1-score' of 0.90 and a 'macro-averaged F1-score' of 0.60. What does this discrepancy most likely indicate?
Model evaluation using confusion matrix, precision, recall, F1-Score
Hard
A.The model is equally good/bad across all classes, and the difference is due to a calculation error.
B.The model performs poorly on the majority class (A) but very well on the minority classes (B and C).
C.Micro-F1 is always higher than Macro-F1, so this is expected behavior for any imbalanced dataset.
D.The model performs exceptionally well on the majority class (A) but poorly on the minority classes (B and C).
Correct Answer: The model performs exceptionally well on the majority class (A) but poorly on the minority classes (B and C).
Explanation:
Micro-averaging aggregates the contributions of all classes to compute the average metric. It is essentially a global calculation of precision and recall, which means it is heavily weighted by the performance on the most frequent classes. A high micro-F1 (0.90) suggests good overall performance, dominated by the large number of correct predictions for class A. Macro-averaging computes the metric independently for each class and then takes the average, treating all classes equally. A low macro-F1 (0.60) indicates that the average performance per class is poor. The large discrepancy means that the high performance on class A is masking very poor performance on the rare classes B and C, which are being averaged down in the macro-F1 score.
Incorrect! Try again.
50You are building a logistic regression model and decide to use L1 regularization (Lasso). You have two features, and , that are highly correlated (e.g., temperature in Celsius and Fahrenheit). How will L1 regularization likely treat the coefficients for these two features compared to L2 (Ridge) regularization?
Logistic Regression
Hard
A.L2 will select one feature and shrink the other to zero, while L1 will keep both but with smaller magnitudes.
B.Both L1 and L2 will shrink one of the feature coefficients to exactly zero to eliminate the redundancy.
C.L1 will assign large, equal, and opposite-signed coefficients to both features, while L2 will assign them small, similar coefficients.
D.L1 will arbitrarily select one feature and shrink its coefficient to zero while keeping the other, whereas L2 will shrink both coefficients towards zero but keep them both non-zero.
Correct Answer: L1 will arbitrarily select one feature and shrink its coefficient to zero while keeping the other, whereas L2 will shrink both coefficients towards zero but keep them both non-zero.
Explanation:
L1 regularization (Lasso) promotes sparsity by adding a penalty proportional to the absolute value of the weights (). When faced with a group of highly correlated features, Lasso tends to be unstable and will arbitrarily pick one feature from the group to have a non-zero coefficient, while shrinking the coefficients of the other correlated features to exactly zero. L2 regularization (Ridge) adds a penalty proportional to the squared magnitude of the weights (). It does not perform feature selection in this way. Instead, it will shrink the coefficients of the correlated features together, distributing the 'importance' among them and keeping them all in the model with small, similar coefficient values.
Incorrect! Try again.
51What is the primary motivation for using the dual formulation to solve the optimization problem for a Support Vector Machine, especially when using the kernel trick?
Support Vector Machine
Hard
A.The dual problem is always a convex optimization problem, whereas the primal is not.
B.The dual formulation's complexity depends on the number of features, making it efficient for datasets with many samples but few features.
C.The dual problem requires fewer constraints and is therefore simpler for standard optimization libraries to solve.
D.The dual formulation expresses the optimization in terms of dot products of feature vectors (), which allows for the substitution of these dot products with a kernel function without ever explicitly mapping to the high-dimensional space.
Correct Answer: The dual formulation expresses the optimization in terms of dot products of feature vectors (), which allows for the substitution of these dot products with a kernel function without ever explicitly mapping to the high-dimensional space.
Explanation:
Both the primal and dual SVM problems are convex. The key advantage of the dual formulation is that the data points only appear in the form of dot products (). This structure is what enables the kernel trick. Instead of performing an expensive, or even infinite-dimensional, explicit transformation and then computing the dot product , we can replace the dot product with a kernel function that computes the same value efficiently in the original feature space. This makes it computationally feasible to create non-linear decision boundaries in very high-dimensional feature spaces.
Incorrect! Try again.
52You train a decision tree on a dataset and then rotate the entire dataset by 45 degrees. You then train a new decision tree with the same hyperparameters on this rotated data. How will the performance and the structure of the new tree likely compare to the original one?
Decision Tree
Hard
A.The performance will likely be significantly worse, and the tree will be much deeper and more complex.
B.The performance will be identical, but the tree structure will be simpler.
C.The performance and structure will be identical because rotation is a linear transformation.
D.The performance will be significantly better because the rotation might align the classes with the axes.
Correct Answer: The performance will likely be significantly worse, and the tree will be much deeper and more complex.
Explanation:
Decision trees are not rotation-invariant. Their splitting criteria are based on axis-aligned thresholds (e.g., ). When the data is rotated, a simple decision boundary in the original space may become a complex, diagonal one in the new, rotated space. The decision tree will have to approximate this new diagonal boundary with a large number of axis-aligned 'stair-step' splits. This will result in a much more complex and deeper tree, which is more likely to overfit the training data and generalize poorly to unseen data, thus leading to worse performance.
Incorrect! Try again.
53Consider using a Gaussian Naïve Bayes classifier for a binary classification problem with two continuous features. The true decision boundary between the two classes is a circle. What shape will the decision boundary learned by the Gaussian Naïve Bayes classifier have, and why?
Naïve Bayes Classifier
Hard
A.A circle or an ellipse, as it can model the covariance between features.
B.Always a straight line, as Naïve Bayes is a linear classifier.
C.A linear or quadratic curve (like a line, parabola, hyperbola, or ellipse), because the log-ratio of the class posteriors forms a quadratic function of the features.
D.A set of axis-aligned rectangles, similar to a decision tree.
Correct Answer: A linear or quadratic curve (like a line, parabola, hyperbola, or ellipse), because the log-ratio of the class posteriors forms a quadratic function of the features.
Explanation:
The decision boundary in a Gaussian Naïve Bayes (GNB) classifier occurs where the posterior probabilities are equal: . By expanding this using Bayes' theorem and the Gaussian PDF, and then taking the logarithm, the decision boundary is defined by an equation that is quadratic in the features . The quadratic terms come from the part of the Gaussian distribution. If the variance is assumed to be the same for both classes, the quadratic terms cancel out, resulting in a linear boundary. However, if the variances differ between classes, the boundary will be quadratic, which can take the form of a hyperbola, parabola, or ellipse/circle. Therefore, GNB is a linear classifier only under the specific condition of equal class variances.
Incorrect! Try again.
54You are applying KNN to a dataset with a mix of numerical and categorical features. A common approach for handling categorical features is to use one-hot encoding. What is a significant drawback of this approach, particularly in combination with the standard Euclidean distance metric?
K-Nearest Neighbors
Hard
A.One-hot encoding is computationally inefficient and cannot be processed by KNN algorithms.
B.It can cause the categorical features to disproportionately dominate the distance calculation, as a single categorical difference results in a large squared Euclidean distance.
C.It is not a valid technique; categorical features must be encoded as integers.
D.One-hot encoding reduces the dimensionality of the dataset, leading to information loss.
Correct Answer: It can cause the categorical features to disproportionately dominate the distance calculation, as a single categorical difference results in a large squared Euclidean distance.
Explanation:
One-hot encoding creates many new binary features. Consider a categorical feature 'City' with 100 unique values. One-hot encoding creates 100 new columns. If two data points differ in their 'City' (e.g., 'London' vs. 'Paris'), their one-hot vectors will be different in two positions (one is [..., 1, ..., 0, ...] and the other is [..., 0, ..., 1, ...]). In Euclidean distance, the squared difference for these two dimensions will be . This single categorical difference contributes a squared distance of 2. This might be a much larger value than the contribution from several scaled numerical features, causing the categorical feature to overwhelm the distance metric and unduly influence the choice of neighbors. This makes proper feature scaling and potentially using other distance metrics (like Hamming distance for the categorical part) crucial.
Incorrect! Try again.
55A binary classifier is built which, due to a bug, outputs the exact same prediction probability (e.g., 0.6) for every single instance in the test set. What will the Area Under the ROC Curve (AUC-ROC) for this classifier be?
Model evaluation using ROC Curve, ROC-AUC
Hard
A.1.0
B.0.5
C.0.0
D.Undefined, as the curve cannot be plotted.
Correct Answer: 0.5
Explanation:
The ROC curve is created by plotting the True Positive Rate (TPR) against the False Positive Rate (FPR) at various threshold settings. Since this classifier outputs a constant probability, there is only one effective threshold. If we set the threshold below 0.6, all instances are classified as positive (TPR=1, FPR=1). If we set the threshold above 0.6, all instances are classified as negative (TPR=0, FPR=0). The ROC curve therefore consists of only two points: (0,0) and (1,1). The curve is the straight line connecting these two points. The area under this diagonal line is exactly 0.5. This represents the performance of a random classifier, which is what this model effectively is, as it cannot distinguish between positive and negative instances.
Incorrect! Try again.
56How does the 'Pocket Algorithm' modify the standard Perceptron algorithm to handle non-linearly separable data, and what is its primary trade-off?
Perceptron
Hard
A.It uses a kernel function to map the data into a higher dimension where it becomes separable.
B.It adds a regularization term to the update rule, preventing the weights from growing too large.
C.It keeps track of the best weight vector found so far (the one with the fewest misclassifications) in its 'pocket' and returns that vector at the end, rather than the final one.
D.It uses a variable learning rate that decreases over time, allowing it to settle in a local minimum.
Correct Answer: It keeps track of the best weight vector found so far (the one with the fewest misclassifications) in its 'pocket' and returns that vector at the end, rather than the final one.
Explanation:
The standard Perceptron algorithm does not converge on non-linearly separable data. The Pocket Algorithm is a modification that addresses this. While the main Perceptron weight vector continues to be updated with every misclassification, the algorithm also maintains a separate weight vector in its 'pocket'. After each update, the new weight vector is evaluated on the entire training set. If it has fewer misclassifications than the vector currently in the pocket, it replaces it. After a set number of iterations, the algorithm returns the pocketed weight vector, not the final updated one. The trade-off is that it is more computationally expensive because it requires evaluating the entire dataset after each weight update, but it guarantees to find a reasonably good (though not necessarily optimal) solution even for non-separable data.
Incorrect! Try again.
57In the context of a soft-margin SVM, what is the primary role of the slack variables in the primal optimization problem formulation?
Support Vector Machine
Hard
A.They allow the optimization to find a separating hyperplane by permitting some data points to be on the wrong side of the margin or even the wrong side of the decision boundary.
B.They are Lagrange multipliers used to enforce the constraints of the optimization problem.
C.They measure the distance from a correctly classified point to the decision boundary.
D.They represent the support vectors and are non-zero only for those points.
Correct Answer: They allow the optimization to find a separating hyperplane by permitting some data points to be on the wrong side of the margin or even the wrong side of the decision boundary.
Explanation:
In a hard-margin SVM, all points must be correctly classified and be outside the margin. This is often impossible with real-world, noisy data. The soft-margin SVM introduces non-negative slack variables for each data point . The constraint becomes . If a point is correctly classified and outside the margin, . If it is on the margin or inside it (a margin violation), . If it is on the wrong side of the decision boundary (a misclassification), . The objective function is then modified to penalize the sum of these slack variables, controlled by the hyperparameter C. This allows the model to find a balance between maximizing the margin and minimizing the classification errors.
Incorrect! Try again.
58Which of the following scenarios best illustrates the bias-variance trade-off in the context of choosing between a simple linear model (like Logistic Regression) and a complex non-linear model (like a deep Decision Tree)?
Introduction to supervised Learning
Hard
A.The linear model, being simpler, is likely to have high bias and low variance, underfitting the data. The complex decision tree is likely to have low bias and high variance, overfitting the data.
B.The linear model will have high bias and high variance on small datasets, while the decision tree will have low bias and low variance on large datasets.
C.The bias-variance trade-off implies that increasing the amount of training data will always decrease both bias and variance for both models.
D.The linear model has low bias and low variance, while the decision tree has high bias and high variance.
Correct Answer: The linear model, being simpler, is likely to have high bias and low variance, underfitting the data. The complex decision tree is likely to have low bias and high variance, overfitting the data.
Explanation:
The bias-variance trade-off is a central concept in supervised learning. Bias is the error from erroneous assumptions in the learning algorithm. High bias (underfitting) means a model is too simple to capture the underlying patterns (e.g., fitting a line to a sine wave). Logistic Regression, being linear, has high bias if the true decision boundary is complex. Variance is the error from sensitivity to small fluctuations in the training set. High variance (overfitting) means a model is too complex and captures noise in the training data (e.g., a deep, unpruned decision tree fitting every single training point). This model will perform poorly on new data. The trade-off is that decreasing bias (by using a more complex model) often increases variance, and vice-versa.
Incorrect! Try again.
59In a logistic regression model, the output is the probability of the positive class, given by the sigmoid function , where . What is the mathematical expression for the gradient of the binary cross-entropy (log loss) function with respect to the linear combination ?
Logistic Regression
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Let . The log loss is . We need to find . Using the chain rule, . First, . A useful property of the sigmoid function is that its derivative is . Multiplying the two parts gives: . This remarkably simple form for the gradient is one reason why the combination of sigmoid and log loss is so widely used.
Incorrect! Try again.
60Consider a binary classification problem where a parent node contains 50 samples of Class 0 and 50 samples of Class 1. A proposed split sends all 50 samples of Class 0 to the left child node and all 50 samples of Class 1 to the right child node. What is the Information Gain of this split, using base-2 logarithm?
Decision Tree
Hard
A.1 bit
B.0 bits
C.2 bits
D.0.5 bits
Correct Answer: 1 bit
Explanation:
Information Gain is calculated as . First, we calculate the entropy of the parent node (). With 50 samples of each of the 2 classes (total 100), the proportions are and . The entropy is bit. Next, we calculate the entropy of the child nodes. The left child has 50 samples of Class 0 and 0 of Class 1, so it is a pure node. Its entropy is 0. The right child has 0 samples of Class 0 and 50 of Class 1, so it is also a pure node. Its entropy is 0. The weighted average entropy of the children is . Therefore, the Information Gain is bit. This represents the maximum possible information gain for a binary split, as the split perfectly resolves all uncertainty.