Which of the following best describes the problem of overfitting during model evaluation?
Think about when a model memorizes training data but fails to generalize.
Overfitting means the model learns the training data too well, including noise, so it fails on new data.
You have a binary classification model for detecting rare diseases in images. Which metric is most appropriate to evaluate the model?
Consider a metric that balances false positives and false negatives.
F1 Score balances precision and recall, making it suitable for imbalanced classes.
What is the output of the following Python code snippet?
from sklearn.datasets import load_digits from sklearn.model_selection import cross_val_score from sklearn.svm import SVC data = load_digits() X, y = data.data, data.target model = SVC(kernel='linear', random_state=42) scores = cross_val_score(model, X, y, cv=5) print(round(scores.mean(), 2))
The digits dataset is relatively easy to classify with a linear SVM.
The linear SVM on the digits dataset typically achieves around 95% accuracy with 5-fold cross-validation.
What error will this code raise when evaluating a classification model?
from sklearn.metrics import accuracy_score y_true = [0, 1, 2, 2, 1] y_pred = [0, 2, 1, 2, 0] score = accuracy_score(y_true, y_pred, average='macro') print(score)
Check the parameters accepted by accuracy_score.
accuracy_score does not accept an 'average' parameter; it causes a TypeError.
You want to build a model to classify images into 10 categories. You have only 500 labeled images. Which approach is best for evaluation and model choice?
Consider data size and evaluation robustness.
Transfer learning leverages pre-trained features, and stratified cross-validation ensures balanced evaluation on limited data.