Graded Quiz: Model Evaluation and Refinement :Data Analysis with Python (Applied Data Science Specialization) Answers 2025
1. Question 1
What does cross_val_predict(lr_model, X_train, y_train, cv=3) return?
-
❌ Predicted values of the test set using cross-validation.
-
❌ Computed a list of residual errors for the training set.
-
❌ Calculated the average R2 score from each fold.
-
✅ Predicted values of the training set using cross-validation.
Explanation:cross_val_predict returns predictions for each training sample, generated by models trained on the other folds (not the final model).
2. Question 2
Correct way to define alpha list for ridge regression grid search?
-
✅ parameter = [{‘alpha’: [1,10,100]}]
-
❌ grid = alpha:[1,10,100]
-
❌ alpha = Ridge([1, 10, 100])
-
❌ parameter =[alpha: 1, 10, 100]
Explanation:
GridSearchCV expects a dictionary:{'alpha': [values]} and wrapped inside a list.
3. Question 3
Model has 100-degree polynomial and R² = 0.99 on training. What next?
-
✅ Evaluate the model on the test datasets.
-
❌ Reduce the number of features before training.
-
❌ Use cross_val_predict on the training data.
-
❌ Select the model based on training score.
Explanation:
A high training R² with complex model suggests overfitting.
Check test performance to confirm.
4. Question 4
Why select ridge over standard linear regression?
-
✅ To reduce overfitting by penalizing large coefficients
-
❌ To remove irrelevant features from the model
-
❌ To increase the model’s flexibility and fit
-
❌ To reduce the model’s complexity and coefficients
Explanation:
Ridge regression adds L2 penalty, which shrinks large coefficients and helps control overfitting.
5. Question 5
Image description: Blue curve (model) is highly wiggly, matching each dot but not true line → This indicates:
-
❌ The model is a good fit
-
❌ No conclusion for the model
-
✅ It displays overfitting
-
❌ It displays underfitting
Explanation:
The model follows noise in the training data rather than the true function → classic overfitting.
🧾 Summary Table
| Ques | Correct Answer | Key Concept |
|---|---|---|
| 1 | cross_val_predict returns predictions for training set | Cross-validation prediction |
| 2 | parameter = [{‘alpha’:[1,10,100]}] | GridSearchCV parameter format |
| 3 | Evaluate on test data | Overfitting detection |
| 4 | Penalizes large coefficients | Ridge regression purpose |
| 5 | Overfitting | Model interpretation |