What machine learning is
Machine learning is a branch of artificial intelligence in which a system learns patterns from data in order to make predictions or decisions, instead of following rules written by a programmer. In traditional programming you supply rules and data and get answers; in machine learning you supply data (often with the known answers) and the algorithm produces the model, a function with fitted parameters that turns an input into a prediction.
A few words come up in every question. Features are the input variables that describe each example, such as the number of links in an email. A label is the known correct answer for a training example, such as “spam”. Training fits the model to data, and inference uses the trained model on new data.
Supervised learning: classification and regression
In supervised learning the model is trained on labelled data: every example comes with the correct answer, and the model learns the relationship between the features and the label. It does two kinds of task. Classification predicts a category, such as whether an email is spam or which digit an image shows. Regression predicts a continuous number, such as a house price or tomorrow’s temperature.
The output decides which one it is, not the topic. Predicting “hot, mild or cold” is classification; predicting 23.4 °C is regression.
Unsupervised and reinforcement learning
In unsupervised learning the data has no labels, and the algorithm finds structure on its own. Clustering puts similar examples into groups, for example segmenting customers by shopping habits or flagging behaviour that fits no group. Association rules find items that often appear together, as in market basket analysis: people who buy pasta and tomatoes tend to buy cheese.
In reinforcement learning an agent learns by trial and error in an environment. In each state it chooses an action, the environment changes and returns a reward, positive or negative, and the agent learns a policy that maximises the cumulative reward over time. It has to balance exploring new actions with exploiting the ones it already knows work. AlphaGo Zero learned Go from games against itself, and robots that learn to walk by trial and error work the same way.
Deep learning and transfer learning
Deep learning uses artificial neural networks with many hidden layers. Each neuron combines its inputs with weights that are adjusted during training; early layers pick out simple features, such as edges in an image, and later layers combine them into complex ones, such as faces. The network learns its features from raw data, which is its main advantage, but it needs a lot of data and computing power and is hard to explain.
Transfer learning takes a model already trained on a large general task, for example millions of photos of everything, and fine-tunes it on a much smaller dataset for a related task, such as a few thousand photos of skin lesions. It needs far less labelled data, time and energy, which puts machine learning within reach of a hospital or a small company. The model also inherits the biases of the original data, and it helps little when the new task is very different. How the specific algorithms work (k-NN, decision trees, clustering, neural networks) is in the HL part of the syllabus.