Table of Contents:
1. Introduction
2. Types of Machine Learning
- Supervised Learning
- Unsupervised Learning
- Semi-supervised Learning
- Reinforcement Learning
3. Self-Supervised Learning
4. Deep Learning
5. How to select a Machine Learning model
6. Conclusion
Introduction
Let's break down machine learning models in the simplest way possible. Think of a machine learning model like a student learning how to solve math problems. Just like a student practices with examples to get better, a machine learning model learns from data. It spots patterns and makes predictions based on what it’s seen before. This is what we mean by "machine learning"—we're teaching computers to learn from experience without giving them step-by-step instructions.
These models are the brains behind a lot of the smart technology we use every day. Ever wonder how Netflix knows what show you might like next? Or how your bank catches suspicious activity on your account? That’s machine learning in action. The model is trained with data (like a student studying) and gets better at its job over time, just like anyone would with practice.
Some models need a little more guidance—they learn from labelled data where the correct answers are already known. Others are more like independent learners; they figure things out on their own without much help. In the world of AI, these models are super important because they’re the building blocks of even cooler stuff, like creating brand-new images or writing text—things that seem almost human.
As we dive into the basics of machine learning models, remember: it’s all about teaching computers to get smarter with experience, just like we do!
Types of Machine Learning
Machines learn in 4 ways:
- Supervised Learning
- Semi-supervised Learning
- Unsupervised Learning
- Reinforcement Learning
1. Supervised Learning
Supervised learning earning is when a model gets trained on a data set, provided by the programmer, also known as an AI Engineer or AI Developer. The model is provided with a dataset, known as a training dataset, which is labelled, which means that it has both input and output parameters. The algorithms learn to make a connection between the input and output.
The programmer then validates the learning by providing unlabelled data in the dataset, known as testing data which the algorithm then provides the labels based on what it has learned.
Supervised learning is further divided into 2 categories:
- Classification – The model is trained to output a discrete category or class. For example, classifying emails as spam or not spam, grading students based on their marks.
- Regression – The model is trained to output a continuous variable which represents numerical values. For example, predicting the price of a house based on size, location and amenities.
2. Unsupervised Learning
Here, there is no answer key to the data inputted into the machine. The machine must find patterns and organize the information on its own. As it analyses more data, its decision-making ability gradually improves and becomes more precise.
Unsupervised learning uses several different techniques, such as:
1. Clustering - Clustering involves grouping a set of objects in such a way that objects in the same group (or cluster) are more like each other than to those in other groups.
2. Association - Association techniques find interesting relationships or patterns between variables in large datasets.
3. Dimensionality reduction - Dimensionality reduction involves reducing the number of random variables under consideration, simplifying the dataset while retaining its essential information.
4. Anomaly Detection - Anomaly detection identifies rare items, events, or observations that raise suspicions by differing significantly from most of the data.
3. Semi-supervised Learning
Semi-supervised learning is a mix of supervised and unsupervised learning. The machine is trained on a small amount of labelled data and a larger amount of unlabelled data. The labelled data helps guide the learning process.
4. Reinforcement Learning
Reinforcement learning (RL) is a technique that trains software to make decisions for optimal results. It mimics the trial-and-error learning process humans use to achieve their goals, reinforcing actions that contribute to the goal and ignoring those that do not.
Key Concepts
- Agent: The learner or decision-maker, like a robot or a software program.
- Environment: The world in which the agent operates and makes decisions.
- State: A specific situation in the environment at a given time.
- Action: A decision or move the agent can make.
- Reward: Feedback from the environment in response to the agent’s action. It can be positive or negative.
- Policy: A strategy that the agent uses to decide which actions to take based on the current state.
- Value Function: A function that estimates the expected cumulative reward from a given state, helping the agent to make better decisions.
How It Works
Imagine you have a robot in a maze. The robot gets a reward for reaching the end of the maze and is penalized for hitting a wall or taking too many steps.
Over time, the robot learns the quickest and least obstructive way to reach its goal.
Reinforcement learning is classified into 2 types -
Model-based RL – The machine builds a model of the environment and uses it to plan its actions. This model could be transition based, where it predicts the next state, or reward based, where it predicts the reward.
Model-free RL – The machine does not build a model of the environment. Instead, it learns a policy which maps states to actions, or a value function – which estimates the expected rewards for each combination of states and actions.
In short, model-based RL relies on planning before acting, while model-free RL uses a simpler but potentially less efficient trial and error method of achieving the same goal.
Self-Supervised Learning
Imagine you’re solving a puzzle where some pieces are missing. You don’t have an answer key, but you can use the surrounding pieces to guess what the missing ones might look like. Over time, you get better at filling in the gaps based on the patterns you’ve learned.
This is similar to how Self-Supervised Learning works. Self-supervised learning is a type of machine learning where the model teaches itself to learn from data by creating its own labels or tasks. Instead of relying on human-provided labels, the model generates labels from the data itself, allowing it to learn without needing a large amount of labelled data.
Deep Learning
Deep learning is a branch of machine learning that harnesses deep neural networks—complex layers of interconnected nodes inspired by the human brain—to replicate intricate decision-making processes. Many of today's AI applications rely on some variant of deep learning for their functionality.
Deep Learning Basics
- Neural Networks: Deep learning is a type of machine learning that uses neural networks, which are inspired by the way the human brain works. A neural network consists of layers of nodes (neurons) that process information.
- Layers: In a neural network, there are multiple layers:some text
- Input Layer: This layer takes in the raw data, like an image or text.
- Hidden Layers: These layers process the data by applying mathematical transformations. Each hidden layer extracts increasingly complex features from the data.
- Output Layer: This layer produces the final result, such as a classification (e.g., identifying a cat in a photo) or a prediction (e.g., predicting house prices).
- Deep Learning: When a neural network has many hidden layers (hence "deep"), it is called a deep neural network. These deep networks can learn to recognize very complex patterns in the data.
How Deep Learning Works
- Training: Deep learning models are trained using a large amount of labelled data. During training, the model adjusts its internal parameters (weights) to minimize the difference between its predictions and the actual labels.
- Backpropagation: This is the process of updating the weights in the network. The model calculates the error of its prediction and then propagates this error backward through the network to adjust the weights, making the model better over time.
- Activation Functions: These functions decide whether a neuron should be activated or not. They introduce non-linearity into the network, allowing it to learn complex patterns. Common activation functions include ReLU (Rectified Linear Unit), sigmoid, and tanh.
- Loss Function: This function measures how well the model's predictions match the actual labels. The goal of training is to minimize the loss function.
Examples of ML Models
Now that you know the types of Machine Learning, here is a chart which lists just a few examples of each type of ML Model
How to select a Machine Learning model
Choosing an ML algorithm can be a bit of a process, so here’s a simplified guide:
- Understand the Problem: First, figure out what you’re trying to solve. Are you doing classification (like spam vs. non-spam), regression (predicting prices), clustering (grouping similar items), or something else?
- Know Your Data: Look at your data. Is it labelled (for supervised learning) or unlabelled (for unsupervised learning)? Is it numerical or categorical? How much data do you have?
- Pick a Starting Point: Start with a few algorithms that match your problem type. For classification, you might try Logistic Regression or a Decision Tree. For clustering, try k-Means or DBSCAN.
- Check Performance: Train your models and see how well they perform. Use metrics like accuracy, precision, recall, or mean squared error depending on your task.
- Tune and Optimize: Adjust the settings of your algorithms (like learning rate, number of trees, etc.) to improve performance. This is called hyperparameter tuning.
- Evaluate and Compare: Compare the results of different algorithms. Choose the one that gives the best performance and fits your needs.
- Consider Practicalities: Think about factors like how fast the algorithm runs, how easy it is to implement, and how well it scales with more data.
- Deploy and Monitor: Once you’ve chosen the best algorithm, use it in real-world scenarios and keep an eye on how it performs over time. Make adjustments if needed.
Conclusion
To wrap things up, machine learning models are like a toolbox with a bunch of different gadgets, each suited for different jobs. Whether you're trying to predict something, classify data, or find hidden patterns, there’s probably a model that fits the bill.
Machine Learning is a vast field with huge scope. This article is designed to be a birds-eye view of Machine Learning models. For a more comprehensive guide to Machine Learning, check out our MLOps course for beginners.