Introduction to Machine Learning (Ultimate Guide 2023)

Machine Learning (ML) is a subfield of Artificial Intelligence that provides computers the ability to learn from massive amounts of data in order to perform cognitive tasks like Computer Vision, Natural Language Processing, Speech Recognition and Synthesis, and many more.

Human Brain Connectome (map of all neural connections)

Machine Learning has become a technology with a wide presence, it is currently being used in autonomous vehicles, robots, face recognition and language translation systems, among many other real-world applications.

Learning Paradigms

Machine Learning algorithms are divided into four categories, the first two being the most common:

  • Supervised Learning: these algorithms have prior learning based on a system of labels associated with some data that allow them to make decisions or predictions. An example is a spam detector that labels an e-mail as spam or not depending on the patterns it has learned from the e-mail history (sender, text/image ratio, keywords in the subject, etc.).

  • Unsupervised Learning: these algorithms have no prior knowledge. They confront the chaos of data in order to find patterns that allow them to be organized in some way. For example, in the marketing field, they are used to extract patterns from massive data from social networks and create highly segmented advertising campaigns.

  • Self-supervised Learning: these algorithms transform the unsupervised problem into a supervised problem by auto-generating the labels. It can be regarded as an intermediate form between supervised and unsupervised learning.

  • Reinforcement Learning: these algorithms are designed to learn from their own experience. That is, they are capable of making the best decision in different situations according to a trial and error process in which correct decisions are rewarded.

Supervised Learning

“If you want to master something, teach it.” — Richard Feynman

The goal of supervised learning is to find a function that can map new inputs to desired outputs. This function is typically learned by training a model on a dataset, which is a collection of data points that have known inputs and outputs.

The most common type of supervised learning is regression, which is used to predict continuous values. For example, regression could be used to predict the future price of a stock, based on historical data.

Other types of supervised learning include classification, which is used to predict discrete values, and sequence learning, which is used to predict values over time.

Supervised learning is typically performed using a neural network, which is a type of machine learning model that is inspired by the brain.

Neural networks are composed of layers of connected nodes, or neurons. Each node performs a simple calculation, and the output of the node is passed to the next node in the layer. The final output of the neural network is the predicted value.

Training a neural network requires adjusting the weights of the connections between the nodes, this is typically done using a method called backpropagation.

Gradient descent is the process of iteratively adjusting the weights of the connections in the neural network in order to minimize a cost function. The cost function is a measure of how well the neural network is performing.

Once the neural network has been trained, it can be used to make predictions on new data. This process is known as inference. In order to make a prediction, the input data is fed into the neural network, and the weights of the connections are used to determine the output of the network.

Neural networks are powerful tools for supervised learning, and they have been used to achieve state-of-the-art results in many applications.

Unsupervised Learning

Unsupervised learning is a branch of machine learning that deals with making predictions on data without any labels. That is, there is no right or wrong answer, and the aim is to find some structure or meaning in the data without any human guidance.

This can be done in a number of ways, but most commonly unsupervised learning is used for clustering, where the data is divided into groups based on similarity. Other methods include association, which looks for relationships between items, and dimensionality reduction, which reduces the number of features in the data.

Unsupervised learning is often used when there is no labeled data available, or when the labels are not very accurate. It can also be used to pre-process data before feeding it into a supervised learning algorithm.

Clustering is the most common unsupervised learning technique. It is used to group data points together based on similarity. There are a number of different algorithms that can be used for clustering, but the most popular are k-means and hierarchical clustering.

K-means clustering works by randomly choosing K data points and then assigning all other data points to the cluster that is closest to them, determined by a chosen distance formula. This is repeated until the clusters converge.

Hierarchical clustering works by creating clusters that have a predetermined ordering from top to bottom. For example, all files and folders on the filesystem are organized in a hierarchy.

There are two types of hierarchical clustering, Divisive and Agglomerative.

In divisive or top-down clustering method we assign all of the observations to a single cluster and then partition the cluster to two least similar clusters. Finally, we proceed recursively on each cluster until there is one cluster for each observation.

In agglomerative or bottom-up clustering method we assign each observation to its own cluster. Then, compute the similarity (e.g., distance) between each of the clusters and join the two most similar clusters. Finally, repeat steps 2 and 3 until there is only a single cluster left.

Dimensionality reduction is a technique that is used to reduce the number of features in the data. The most common algorithm for dimensionality reduction is Principal Component Analysis (PCA). PCA works by finding the directions of maximum variance in the data, and then projecting the data onto these directions. This reduces the dimensions of the data while preserving the most information. PCA is often used to reduce the dimensions of high-dimensional data, such as images.

Self-supervised Learning

“Self-supervised learning is the dark matter of intelligence” — Yann LeCun

Self-supervised learning is a machine learning process where the model trains itself to learn one part of the input from another part of the input. It is also known as predictive or pretext learning. 

In this process, the unsupervised problem is transformed into a supervised problem by auto-generating the labels. To make use of the huge quantity of unlabeled data, it is crucial to set the right learning objectives to get supervision from the data itself.

The process of the self-supervised learning method is to identify any hidden part of the input from any unhidden part of the input.

For example, in natural language processing, if we show the computer only a few words in a sentence, using self-supervised learning it will learn to complete the rest of the sentence. Similarly, in a video, we can predict past or future frames based on available video data.

Self-supervised learning uses the structure of the data to make use of a variety of supervisory signals across large data sets – all without relying on labels.

Reinforcement Learning

Reinforcement learning is a type of learning that focuses on taking actions in an environment in order to maximize a reward.

The key idea is that the agent learns by trial and error, receiving a reward for each action that it takes. Over time, the agent learns to take the actions that lead to the highest rewards, and therefore the best performance.

In order for reinforcement learning to be effective, the agent needs to be able to learn from its experience and adapt its behavior accordingly. This is where neural networks come in. Neural networks are well-suited for learning from experience and making predictions.

There are a few different ways to train a neural network with reinforcement learning. One popular method is called Q-learning.

The idea behind Q-learning is to learn a function that maps states to action values. This function is called the Q-function, and it is used to select the action that maximizes the expected reward.

The Q-function can be learned using a neural network. The advantage of using a neural network to represent the Q-function is that it can learn to approximate the Q-function even in environments that are too complex for traditional reinforcement learning algorithms.

Conclusion

Machine learning is a vast and growing field of computer science with many different subfields and applications. In this introduction we have looked at some of the most popular methods of machine learning: supervised learning, unsupervised learning, self-supervised learning and reinforcement learning. Each of these has its own strengths and weaknesses and is best suited to different tasks.

Previous
Previous

Cash Counting App using React Native and Computer Vision (YOLO v7 Tutorial 2023)

Next
Next

How to Label Images for Object Detection (Free Guide 2023)