Machine Learning Quiz
Test your machine learning knowledge with these questions on the whole tutorial.
How the Quiz Works
Read each question, choose one answer, and check the explanation. If you get a question wrong, go back to the chapter it comes from:
| Questions | Chapter |
|---|---|
| 1-2 | Introduction, Types of Learning |
| 3-4 | Data and Features, Train/Test Split |
| 5-7 | Linear Regression, Classification, Decision Trees |
| 8-10 | Evaluating Models, Overfitting |
A Quick Recap
Every scikit-learn project you built in this tutorial followed the same shape:
Example
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
X, y = load_iris(return_X_y=True) # 1. data
X_train, X_test, y_train, y_test = train_test_split( # 2. split
X, y, test_size=0.2, random_state=0, stratify=y
)
model = DecisionTreeClassifier(max_depth=3, random_state=0) # 3. choose a model
model.fit(X_train, y_train) # 4. train
print(model.predict(X_test[:3])) # 5. predict[0 1 0]
Keep this pattern in mind while you answer.
Questions
Exercise
1. Which of these is a supervised learning problem?
Exercise
2. Predicting whether a loan will be approved or rejected is which kind of task?
Exercise
3. In scikit-learn code, what do X and y usually hold?
Exercise
4. Why do we keep a test set that the model never trains on?
Exercise
5. A linear regression for marks has slope 5 and intercept 30. What does it predict for 4 hours of study?
Exercise
6. Which scikit-learn model is a classifier, despite having "regression" in its name?
Exercise
7. What is a random forest?
Exercise
8. Only 1% of transactions are fraud. A model always predicts "not fraud". Which statement is true?
Exercise
9. Training accuracy is 0.62 and test accuracy is 0.60. What is the most likely problem?
Exercise
10. What does cross_val_score with cv=5 do?
What Next?
Well done on finishing the tutorial. To keep going, practise on real datasets in the Data Science tutorial, or learn how large language models work in Generative AI.
Machine learning becomes clear only with practice. Take a small dataset you care about, such as your own monthly expenses or cricket scores, and try to predict something from it.
