IInfo1
Technology

Machine Learning

Waldeilson Santos2020-07-04

Understand what Machine Learning (ML) is and the difference between ML and AI

Imagine we want to create a program capable of identifying whether an image contains a car or not. For this, some fundamental challenges arise:

  • How to make this distinction programmatically?
    What features of an image allow us to confidently state that it contains a car?

  • How to deal with the diversity of the real world?
    Cars appear in different colors, models, sizes, angles, scales, lighting conditions, and even partially hidden. How could we manually program all these variations?

  • How to generalize to new examples?
    Even if it were possible to cover many known scenarios, how can we ensure the system correctly identifies images never presented during its training?

To solve this problem, wouldn't it be more efficient if the program could recognize patterns that characterize a car?

This is exactly where Machine Learning (ML) comes into play. ML is a field of Artificial Intelligence that allows systems to learn patterns from data, instead of relying solely on manually programmed rules.

In this sense, Machine Learning can be seen as a natural evolution of pattern recognition studies, making it possible to deal with the complexity and variability of the real world.

Definitions

There are several definitions for Machine Learning. The book The Hundred-Page Machine Learning Book adopts a relatively simple definition:

Machine learning is the process of solving practical problems by collecting data and using that data to build statistical models using algorithms.

Unlike the purely programmatic approach, machine learning seeks to solve problems based on examples, not just explicit rules. This is where the concept of "learning" comes from: the system extracts patterns from data and uses them to generalize solutions to new scenarios.

Dataset

Data collection is one of the initial and most important steps in the machine learning process. Understanding the terms below helps to understand how data is organized and used during model training:

  • Dataset: the set of data that will be studied and used to train, validate, and test machine learning models.

  • Features: a set of one or more independent variables that describe the characteristics of each record in the dataset.

  • Label: the expected result or dependent variable associated with the features. It can be a numeric value, a class, or even more complex structures.
    Datasets that have labels are also known as annotated datasets.

For example, imagine we want to estimate a person's weight based on their height. In this case, height is an independent variable (feature), while weight is the dependent variable (label).

Note that we could use other independent variables to make the model more accurate, such as the number of calories consumed per day, gender, age, level of physical activity, among others.

Example dataset:

Height (feature) Weight (label)
142 cm 40 kg
150 cm 50 kg
162 cm 70 kg
177 cm 75 kg
190 cm 101 kg

The main types of machine learning:

  • Supervised learning
  • Semi-supervised learning
  • Unsupervised learning
  • Reinforcement learning

Supervised learning

In supervised learning, the dataset contains both features and labels. This means that for each set of characteristics, we already know the expected result of their combination. From these known values, it is possible to train models capable of estimating the labels of new records that are not part of the original dataset.

Returning to the example of weight as a function of height, we can use linear regression to estimate, for example, that a person with 170 cm in height weighs approximately 74 kg. It is important to note that this value is only an estimate: even for known data, the model may show variations. This happens because the model is relatively simple, and to obtain more accurate predictions, it would be necessary to consider more features, such as age, gender, body composition, among others.

Unsupervised learning

Unlike supervised learning, in unsupervised learning we do not know in advance the result of the combination of features, that is, the dataset does not have labels.

In this type of learning, the goal is to build models capable of extracting structure and patterns from the data, transforming the dataset in different ways, such as:

  • Clustering of records
  • Outlier detection
  • Dimensionality reduction

These techniques are widely used for data exploration, discovery of hidden patterns, and data preparation for later analysis or modeling steps.

Semi-supervised learning

Semi-supervised learning is a hybrid model between supervised and unsupervised learning, as the dataset contains records with and without labels. In many scenarios, obtaining properly annotated data is significantly more difficult and costly than collecting unlabeled data. Therefore, this approach seeks to take advantage of both types of data to improve model performance.

At first glance, the idea that unlabeled data can contribute to model quality may seem counterintuitive. However, returning to the example of weight as a function of height, imagine we have many records of height without the corresponding weight. By applying unsupervised learning techniques, it is possible to obtain a more solid basis for identifying patterns and detecting outliers, which indirectly contributes to building more robust supervised models.

Another common technique is to initially train the model only with annotated data, then estimate the labels of the unlabeled data, and finally retrain the model using the entire dataset.

This approach allows taking advantage of the large amount of unlabeled data available, increasing the training base and potentially improving the model's generalization ability.

Reinforcement Learning

Among the main types of machine learning, reinforcement learning is undoubtedly the most complex—and also one of the most powerful. In this approach, the model uses the state of the environment as input to decide which action should be executed.

Each action may or may not change the state of the environment and, after its execution, a reward is calculated. This reward indicates whether the model's behavior is improving or worsening, which gives rise to the concept of reinforcement.

The goal of reinforcement learning is to learn a policy of actions that maximizes the accumulated reward over time, allowing the agent to make increasingly efficient decisions based on the experience acquired.

This type of learning is especially suitable for tasks involving sequential decisions, such as:

  • Learning to play a game
  • Learning to control a robot
  • Logistics optimization, such as routing and resource allocation

Conclusion

Machine Learning is a subfield of Artificial Intelligence focused on pattern recognition from data. Currently, its applications are broad and cover several domains, such as data analysis, computer vision, recommendation systems, automation, and intelligent decision-making, including popular LLMs (Large Language Models), like ChatGPT.

ChatGPT, for example, uses Deep Learning, based on artificial neural networks of the Transformer type, trained with large volumes of text to identify patterns in human language.

During training, the model learns to predict the next word based on context, which makes it possible to answer questions, explain concepts, and generate coherent texts.

In summary:

Artificial Intelligence → Machine Learning → Deep Learning → ChatGPT


References: