background

The Different Types of Learning

Uwais Iqbal2022-11-02


The goal of Machine Learning is to learn how to perform a particular task. There are a number of ways this learning can be carried out.

With Machine Learning there are different ways of getting the machine to learn how to perform a particular task. The main ways are:

  1. Online Learning
  2. Offline Learning
  3. Active Learning

Online Learning

In online learning, data is constantly being streamed into the model and is used to update the model. The model is learning ‘online’ meaning it is continuously learning as data is fed through.

An example of an online learning model is Netflix’s recommendation system. As you provide feedback on which shows you enjoy, these data points are fed into the model and the model is updated. The model learns something new and your new recommendations are more relevant.

Online learning is typically used for systems where there is a continuous flow of data and the model needs to be sensitive enough to adapt to changing conditions.

Offline Learning

In offline learning, the learning step is done offline with a dataset. Offline learning is done in two main stages:

  1. Training
  2. Inference

Training

Take the example of classifying spam emails. Training is the phase where a model is being taught and trained through a combination of emails and their corresponding spam/not spam labels. The model is taught through data as well as annotations.

training-phase

The model learns by recognising patterns in features extracted from the data. The model updates its parameters based on how it performs classifying spam emails. The inputs to this stage are the data with annotated labels and the output is a trained model.

Inference

Once the model has been trained, new emails can be fed into the model to make a prediction as to whether the email is spam or not.

During the inference stage, the model isn’t learning or updating its parameters. It’s just making predictions based on the patterns it has learnt to recognise in the data from the training stage.

inference-phase

During this stage, the data is input to the trained model and a predicted label is output.

From Training to Inference

During the training phase, the model learns from a dataset in a sandbox environment. The trained model is then deployed to a live environment where it only provides predictions for the inference phase. The model no longer learns from the data provided during the inference phase.

If there is a significant difference between the data used during the training phase and the data fed into the model during the inference phase the model will perform poorly. It’s like tutoring a student on mathematics only to then give him an exam on history - it’s no surprise if he ends up failing.

Active Learning

Active learning is an interactive approach where the machine constantly learns but requires human input for things it struggles with. An active learning system is also known as a ‘human-in-the-loop’ system. The model knows which data points it struggles with so actively prompts the human for help.

Once the human provides input, the model learns from this new data and improves. There is a continuous feedback loop between the human and the machine so the model improves over time with human interaction.

Learning in Legal AI

Most Machine Learning models in Legal AI use offline learning where the Training and Inference phases are distinct. Models are usually trained offline and then deployed within a software product so users can consume the predictions of the model. In most cases, the users are only interacting with the model in the inference phase so the model won’t learn from its interactions.

Active learning systems can be particularly useful in Legal AI as a way of promoting human-machine collaboration that will lead to improved performance over time as the system is used.