Machine Learning
Learning from data in plain Python: regression and gradient descent, k-NN, metrics, logistic regression, Naive Bayes, decision trees, k-means and the perceptron.
- 1
What machine learning is
Learning rules from examples instead of writing them: supervised, unsupervised and reinforcement learning, and the words features, labels, model, training and prediction.
- 2
Data, statistics and features
Datasets as rows and columns, mean, median and standard deviation, scaling features with min-max and z-scores, one-hot encoding, and missing values.
- 3
Linear regression
Predict a number with a straight line: residuals, mean squared error, the least-squares formulas for the best line, more features, and reading the result.
- 4
Gradient descent
Train a model by walking downhill on its loss: the gradient, the update rule, the learning rate, and batch, stochastic and mini-batch gradient descent.
- 5
Training, testing and overfitting
Judge a model on data it has never seen: train and test sets, overfitting and underfitting, the bias-variance trade-off, validation sets and cross-validation.
- 6
k-nearest neighbours
Classify a new example by a vote of the k most similar training examples: distances, choosing k, why scaling matters, and the cost of a lazy learner.
- 7
Measuring a classifier
Accuracy and its traps, the confusion matrix, precision, recall and the F1 score, and which one matters for spam filters and medical tests.
- 8
Logistic regression
Classification with probabilities: the sigmoid function, the decision boundary, the log loss, and training by gradient descent.
- 9
Bayes' rule and Naive Bayes
Bayes' rule and the base-rate trap of medical tests, then a Naive Bayes spam filter built from word counts, with Laplace smoothing and log probabilities.
- 10
Decision trees
A tree of yes/no questions: entropy, information gain and the Gini index for choosing each question, overfitting and depth limits, and random forests.
- 11
Clustering with k-means
Unsupervised learning: group unlabelled points by alternating two steps, assign and update; why the start matters; and choosing k with the elbow method.
- 12
Perceptrons and neural networks
An artificial neuron, the perceptron learning rule, why one neuron cannot learn XOR, hidden layers, activation functions, backpropagation, and where deep learning goes next.
- 13
Machine learning in practice
The steps of a real ML project, the libraries professionals use, data leakage, and the questions of fairness, privacy and accountability every model raises.