# Types of machine learning algorithms

27 May 2018As we saw in the first post, machine learning consists of a set of algorithms that learn and solve problems thanks to experience. There are several types of problems that are addressed with machine learning techniques, among them are *classification* problems (where we want to predict a class), *regression* problems, *time series*, etc. In this post I discuss the different types of learning that machine learning algorithms use.

Machine learning algorithms can learn in 4 different ways: through **supervised learning**, with **unsupervised learning**, with **semi-supervised learning** or with **reinforcement learning**.

The first 3 types of algorithms differ in the a priori knowledge that each one has. The two extremes are supervised, where there is a priori knowledge of the data, and the unsupervised, characterized by the absence of a priori knowledge.

## Supervised learning

These methods are the easiest to perform. They are based on a priori knowledge. The objective is, using some training data, to deduce a function that makes the best possible mapping between inputs and output. The training data consist of tuples \((X, Y)\), where \(X\) is the variables that predict a certain output \(Y\).

The variable to predict \( Y \) can be a quantitative variable (as in the case of regression problems) or a qualitative variable (as in the case of classification problems).

The objective of supervised learning is to obtain an unknown \(f\) function given some tuples \((X,Y) = (X,f(X))\).

An estimate \((\hat{f})\) of the function \( f \) is obtained, as that function that minimizes the empirical risk on the training set.

The function of empirical risk has the following formula:

$$R_{emp}(w)=\frac{1}{n}\sum L(y_i,\hat{f}(x_i,w))$$

being \(L\) a cost function, \(w\) a set of parameters and \(x_i\) the data that the variable \(y_i\) predicts.

You can approximate the function f with \(\hat{f}\) such that:

$$\hat{f}(x,w)=\underset{w \in \gamma}{arg\,min} R_{emp}(w)$$

An example of a cost function in a regression problem is:

$$L(y,f(x,w))=(y-f(x,w))^2$$

## Unsupervised learning

Unlike in supervised learning, in this case there is no a priori knowledge. Here you do not have tuples \((X,Y)\), you simply have \(X\).

The goal of unsupervised learning is to model the structure or distribution of the data to learn more about them. It serves both to understand and to summarize a set of data.

It is called unsupervised because, unlike the supervised one, it tends to be more subjective since it does not have correct answers. Algorithms serve to discover and present interesting structures in the data.

In general terms, they can be grouped into clustering algorithms and association algorithms.

## Semi-supervised learning

Semisupervised learning is halfway between supervised and unsupervised learning.

Now what we have is both tagged data and untagged data, that is, in addition to having tuples \((X,Y)\), we have data only of \(X\) of which we do not know your answer \(Y\).

The challenge is to combine tagged and untagged data to build a supervised model model that is better because:

- The amount of tagged data can be increased, which generally improves the results of the models.
- There is a high cost of tagging \(X\) data without labels.
- It assumes that the tagged and untagged data come from the same distribution. On the other hand, there may be a bias in the choice of unlabelled data.

Among the semi-supervised learning methods are:

- Selft-training
- Co-training
- Assemble
- Re-Weighting

## Reinforcement learning

In cases of supervised learning, tuples \((X,Y)\) are available. However, the case of reinforcement learning we have unsupervised problems that only receive re-feeds or reinforcements (for example, win or lose).

The supervised information \((Y)\) is replaced by information of the action/reaction type.

The goal in reinforcement learning is to learn to map action situations to maximize a certain reward function.

In these problems an agent learns by trial and error in a dynamic and uncertain environment.

In each interaction, the agent receives as input a current status indicator and selects a certain action that maximizes a reinforcement or reward function in the long term.

This sequential decision process can be characterized as a Markov process.