Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
What the course covers
What machine learning is and where it fits in a project.
- Linear and logistic regression with scikit-learn.
- Supervised models: decision trees, SVM, KNN and ensembles.
- Unsupervised models: clustering, PCA and dimension reduction.
- How to evaluate, validate and tune a model, plus a final project.
| Module | Main focus |
|---|---|
| Module 1 · about 2 hours | Introduction to Machine Learning: types of learning, model lifecycle, scikit-learn |
| Module 2 · about 3 hours | Linear and Logistic Regression: simple, multiple, polynomial, classification |
| Module 3 · about 4 hours | Building Supervised Learning Models: trees, SVM, KNN, ensembles |
| Module 4 · about 3 hours | Building Unsupervised Learning Models: K-means, DBSCAN, PCA, t-SNE |
| Module 5 · about 4 hours | Evaluating and Validating Models: metrics, cross-validation, regularization |
| Module 6 · about 4 hours | Final Project and Exam: Titanic practice project, rainfall classifier, final exam |
Module 1: Introduction to Machine Learning
Introduction to Machine Learning: types of learning, model lifecycle, scikit-learn.
- Machine learning learns patterns from data. Supervised learning uses labels; unsupervised does not.
- The model lifecycle: define the problem, get data, clean it, train, evaluate, deploy, monitor.
- scikit-learn uses one style:
model.fit(X, y), thenmodel.predict(X).
Module 2: Linear and Logistic Regression
Linear and Logistic Regression: simple, multiple, polynomial, classification.
- Simple linear regression fits a line: y = b0 + b1·x. b0 is the intercept and b1 is the slope.
- Multiple linear regression uses more than one input feature. Polynomial regression fits a curve.
- Logistic regression predicts a class. The sigmoid turns the score into a probability from 0 to 1.
- Split the data first:
train_test_split(X, y, test_size=0.2). Train on one part, test on the other.
Module 3: Building Supervised Learning Models
Building Supervised Learning Models: trees, SVM, KNN, ensembles.
- Classification predicts a category, like spam or not spam. Regression predicts a number.
- A decision tree asks yes/no questions and splits the data. A deep tree overfits.
- SVM finds a boundary with the widest margin. A kernel helps with non-linear data.
- KNN looks at the k nearest points and takes their majority vote (or their mean).
- Ensembles join many models: random forest (bagging) and XGBoost (boosting). Bias = too simple; variance = too sensitive.
Module 4: Building Unsupervised Learning Models
Building Unsupervised Learning Models: K-means, DBSCAN, PCA, t-SNE.
- Clustering groups similar rows when there are no labels.
- K-means repeats two steps: assign points to the nearest centroid, then move the centroid. The elbow method helps choose k.
- DBSCAN finds dense areas and marks lonely points as noise. It needs
epsandmin_samples. - PCA keeps the main variance in fewer features. t-SNE and UMAP make 2-D pictures of high-dimensional data.
Module 5: Evaluating and Validating Machine Learning Models
Evaluating and Validating Models: metrics, cross-validation, regularization.
- Accuracy can lie when classes are unbalanced. Use precision, recall and F1.
- A confusion matrix shows true positives, false positives, true negatives and false negatives.
- Regression metrics: MAE, MSE, RMSE and R². Lower error is better; higher R² is better.
- Cross-validation trains and tests on k different splits, so the score is more stable.
- Regularization (L1/Lasso, L2/Ridge) penalizes big coefficients. Data leakage is test information inside training.
Module 6: Final Project and Exam
Final Project and Exam: Titanic practice project, rainfall classifier, final exam.
- The practice project predicts Titanic survival with pipelines, cross-validation and tuning.
- The final project builds a rainfall prediction classifier. GridSearchCV tries many hyperparameters and keeps the best.
Check yourself
Answer each question first, then open it to check the answer.
1What is supervised learning? a) Learning from data with labels · b) Learning with no data · c) Writing every rule by hand · d) Learning only from images
a) Learning from data with labels. Supervised learning needs labelled examples to learn the link between X and y.
2Which model predicts a class, not a number? a) Simple linear regression · b) Logistic regression · c) Polynomial regression · d) A trend line
b) Logistic regression. Logistic regression outputs a class; linear regression outputs a number.
3What does the slope of a simple linear regression line show? a) The number of rows · b) The test size · c) The change in y for a one-unit change in x · d) The number of clusters
c) The change in y for a one-unit change in x. The slope is the change in y when x grows by one unit.
4What is the sigmoid function used for in logistic regression? a) To turn the output into a value from 0 to 1 · b) To remove rows with missing values · c) To draw a map · d) To scale the labels
a) To turn the output into a value from 0 to 1. The sigmoid maps any score into the range 0 to 1, so we can read it as a probability.
5How does KNN predict the label of a new point? a) It draws a tree · b) It looks at the k nearest points · c) It finds a centroid · d) It runs a SQL query
b) It looks at the k nearest points. KNN takes the labels of the nearest neighbours and votes.
6What does K-means do? a) Groups data into k clusters by the nearest centroid · b) Predicts a number · c) Removes outliers by hand · d) Splits data into train and test
a) Groups data into k clusters by the nearest centroid. K-means moves k centroids until the groups are stable.
7What does PCA do? a) Increases the number of rows · b) Names the clusters · c) Trains a decision tree · d) Reduces the number of features and keeps most of the variance
d) Reduces the number of features and keeps most of the variance. PCA builds new features that keep most of the variance in fewer columns.
8Which metric is better than accuracy when the classes are very unbalanced? a) F1 score · b) The mean of the features · c) The number of rows · d) R²
a) F1 score. F1 joins precision and recall, so a rare class still counts.
9What does a confusion matrix show? a) The list of features · b) Counts of true and false positives and negatives · c) The size of the test set · d) Only the cluster centres
b) Counts of true and false positives and negatives. The four cells hold true positives, false positives, true negatives and false negatives.
10Why use cross-validation? a) To make training faster · b) To delete rows · c) To get a more reliable estimate of model performance · d) To avoid writing code
c) To get a more reliable estimate of model performance. Several splits give a score that changes less from one split to another.
11What is data leakage? a) Test information reaching the training data · b) A slow internet link · c) A missing value · d) A type of cluster
a) Test information reaching the training data. The model sees test data during training, so the test score looks too good.
12What does regularization do? a) It adds more rows · b) It penalizes large coefficients to reduce overfitting · c) It removes the test set · d) It changes the label type
b) It penalizes large coefficients to reduce overfitting. A penalty on large coefficients makes the model simpler and less overfit.
Study and exam tips
Learn the one-line meaning of each model: regression gives a number, classification gives a class, clustering gives groups.
- Keep the metric names straight: accuracy, precision, recall, F1, MAE, RMSE and R².
- Remember the scikit-learn steps: split, scale, fit, predict, score.
- Check the difference between overfitting and underfitting before the quiz.