Avatar or Logo

Training Supervision 👀

Training Supervision 👀

Sunday 31 March, 2024

From Labelled Data to Autonomous Agents

ML models can be classified based on the amount and type of supervision they get during the training stage.

There are many categories but I will cover the main ones: supervised learning, unsupervised learning, self-supervised learning, semi-supervised learning, reinforcement learning.

Supervised Learning

In supervised learning we feed the ML model data that is labelled and also includes the desire solution (target).

Classification task are usually solved with supervised learning. A spam filter is a good example of this, it is trained with many examples of email including their class (spam or not spam), and it must learn how to classify new emails.

Regression task can also be solved with supervised learning. Let's say you wanted to predict the price of a car, you will need to feed the ML model many examples of cars including both their features (milage, number of owners, brand) and their target (price).

Unsupervised Learning

As you might have guessed in unsupervised learning, the training data is unlabelled. The system tries to learn without a teacher.

For example, say you have a lots of data about your ecommerce shop customers. You may want to run a clustering algorithm to try and detect groups of similar customers. At no point do you tell the algorithm which group a customer belongs to: it finds those connections without your help. For example you might notice 40% of your customers who are over the age of 30 spend over £100, while 20% who are under the age of 25 spend less than £50. With this information you can now run specific marketing campaigns for these two groups of customers, promoting more expensive items to customers over 30 and less expensive items to customers under 25.

If you use a hierarchical clustering algorithm, it might also subdivide each group into smaller groups. This might also help you improve your marketing campaigns.

Some other examples of unsupervised learning are:

  • Visualization Algorithms: You feed it lots of complex unlabelled data, and they output a 2D or 3D representation of your data that can be easily plotted. This can help you understand how the data is organised and perhaps identify unsuspected patterns.

  • Dimensionality Reduction: Helps you simplify your data without losing too much information. One way it does this is by spotting correlation between different features and mering them into one.

  • Anomaly Detection: When shown a normal instances during training, so it learns to recognize them; when shown a new instance it can tell weather it looks like a normal one or weather is likely an anomaly.

  • Novelty Detection: It aims to detect new instances that look different from all instances in the training set (requires having a very clean training set)

  • Association Rule Learning: The goal is to dig into large amounts of data and discover relations between attributes.

Semi-supervised Learning

Labelling data is usually time-consuming and costly, you will often have plenty of unlabelled instances, and a few labelled instances. Some algorithms can deal with data that's partially labelled. This is called semi-supervised learning.

An example of this is photo-hosting services, such as Google Photos. Once you upload all of your family photos to the service, it automatically recognise that the same person A shows up in photos 1, 5 and 11, while another person B shows up in photos 2 ,5 and 7. This is the unsupervised part of the algorithm (clustering). Now all the system needs for you to do is to tell it who these people are. Just add one label per person and it is able to name everyone in every photo, which is useful for searching for photos.

Most semi-supervised learning algorithms are a combinations of unsupervised and supervised algorithms.

Self-supervised Learning

Another approach to machine learning involves generating a fully labelled dataset from a fully unlabelled one. Once the whole dataset set is labelled we can then use any supervised learning algorithm. This approach is called self-supervised learning.

An example would be if you have a large dataset of unlabelled images, you can randomly mask a small part of each image and then train the model to recover the original image. During training, the masked images are used as the input to the model, and the original images are used as the labels.

Reinforcement Learning

Reinforcement learning is a powerful strategy. The learning system, called an agent in this context, can observe the environment, select and perform actions and get rewards in response or penalties in form of negative rewards. It must then learn by itself what is the best strategy, called a policy to get the most reward overtime. A policy defines what actions the agent should choose when it is in a given situation.

Conclusion

There are many machine learning strategies you can implement; the goal is to figure out what is the best strategy for your problem. When dealing with labelled data and a specified target, use a supervised learning approach. No labels? Consider unsupervised learning. Half of your data is labelled, and the other half isn't? Try semi-supervised learning. Huge non-categorised data set? Use self-supervised learning to structure your data and find new insights and correlations. Want to set hell loose and let the machine learning model learn by itself? Reinforcement learning will be your best approach. Also, remember, depending on the complexity of the problem and the available data, you might be able to mix all these strategies together to create a hybrid approach.


Acknowledgement: The ideas and concepts discussed in this blog post were inspired by the book "Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow" by Aurélien Géron, published by O'Reilly Media. This book provides a comprehensive guide to machine learning and has been an invaluable resource in understanding the different machine learning strategies and their applications. I highly recommend this book to anyone interested in diving deeper into the world of machine learning.

Reference: Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems. O'Reilly Media, Inc.