How machines Learn: A look into machine learning.
Tags: machinelearning, ai, computerscience, beginners
Published: 2024-05-08 20:44:38

We've all witnessed how powerful machine learning is by using applications like ChatGPT, Gemini, Midjourney, and LeonardoAI. Now you might or may not be familiar with how they work, but essentially algorithms are the secret sauce behind machine learning applications.

A computer can only perform certain tasks in a certain order when it is given a set of precise instructions, this is what is known as algorithms. Think of algorithms as a chocolate cake recipe, which is a step-by-step plan you follow that should give you the same outcome every time. You can add certain ingredients to a recipe to make it better which is similar to feeding the algorithm more data to make it give you a better outcome. 

Now when it comes to machine learning there are three terms that you will constantly come across When you're starting out in this field:
- Supervised learning
- Unsupervised learning
- Reinforcement learning
These are the most common methods that machines learn.

# 1. Supervised Learning
A known link between input and output is used in supervised learning. Labeled data is valuable in this situation because it helps the algorithm learn from the "correct answers" in the training set and use those lessons for predicting future input data.

The two key goals of supervised learning are **Regression** and **Classification**.
There are two main goals for regression analysis.
Regression is used to understand the type of relationship between the variables, and to estimate the value of the dependent variable based on the independent variables, and evaluating the relevance and strength of this relationship.

In classification, the goal is to sort findings based on their characteristics into predefined groups or categories.

Here's a simple example of how a supervised algorithm works. 
Let's imagine we have a set of images where each depicts either a banana or an apple. 

- Create a set of data marked as "correct" data, consisting of images of apples and bananas together with the matching class names.

- Give the model the labeled training dataset. Between the input which is the picture and the output which is the class, the machine learning algorithm starts to "see" patterns. The algorithm may pick up connections, such as the color or the shape of the fruits.

- Measure how well the model predicts the class by running it over some unknown data.

# 2. Unsupervised Learning 
The main distinction between supervised and unsupervised learning is the "correct" data we provided. Unsupervised learning algorithms just need input data. This learning method works well for cases when we don't know exactly what the solutions should look like. Its goal is for the algorithm to learn from the data.

Let's keep it simple and stay with the fruit example. 
Imagine you're sorting a basket of fruits. There are no labels on the items identifying an orange or an apple. Unsupervised learning is like sorting these fruits based on their similarities, like color, shape, or size.
Filtering or sorting these fruits based on similarities in size, color, or form is similar to unsupervised learning. In machine learning, your data points are the fruits, and the characteristics you use to group them are the sorting criteria.

# 3. Reinforcement learning
In reinforcement learning, there is an agent which is the learner that learns through trial and error in an environment. This agent uses the algorithm to make decisions. 

Here's an example: 
Picture a toddler starting to walk. The kid gets a positive reward such as a hug a kiss or even verbal appreciation for taking steps and negative reinforcement such as a fall when taking a wrong step for errors, but no instructions are given. The kid gradually picks up the best techniques to reach the goal of walking.

The goals of reinforcement learning are different from those of unsupervised learning. In comparison with unsupervised learning, which aims to identify clusters in the data, reinforcement learning looks for a suitable action model that increases the agent's total reward.