Today, supervised learning is the most common branch of **machine learning**. Typically, new machine learning professionals will begin their journey with supervised learning algorithms.

The meaning of supervised learning is that we give data to the algorithm that are considered correct answers.

For example, supervised machine learning algorithms are designed to learn. The name supervised learning comes from the idea that teaching this type of algorithm is like having a teacher supervise the entire process.

When a supervised learning algorithm is trained, during training, the algorithm looks for patterns in the data that are associated with desired outputs. After training, a supervised learning algorithm will ignore new inputs and determine which new inputs will be classified based on previous training data. The goal of a supervised learning model is to predict the correct label for new input data. In its most basic form, a supervised learning algorithm can be simply written as:

Y = f(x)

Where Y is the output predicted by a function that assigns a class to an input value x. The function used to connect the input features to the output predicted by the machine learning model is created during training.

Table of Contents

## Types of machine learning algorithms

### Supervised learning (supervised learning)

In this type of algorithm that carries the main burden of machine learning (in terms of the number of algorithms of this type), we deal with two types of variables. The first type, which is called independent variables, is one or more variables that are supposed to predict another variable based on their values. For example, the customer’s age, education, income, and marital status are independent variables for predicting the purchase of a product by a customer. The second type is dependent or target or output variables and we are going to predict their values with the help of these algorithms. For this purpose, we must create a function that takes the inputs (independent variables) and produces the desired output (dependent or target variable). The process of finding this function, which is the discovery of a relationship between independent variables and dependent variables, is called the training process, which is based on existing data (data that both independent variables and dependent variables are known, for example, the past purchases of customers of a store) is applied and continues until the required accuracy is reached.

### Unsupervised learning

In this type of unsupervised learning algorithm, we do not have a target variable and the output of the algorithm is uncertain. The best example that can be given for this type of algorithm is the automatic grouping (clustering) of a population, for example, by having the personal information and purchases of customers, we can automatically divide them into identical and equivalent groups. Apriori and K-Means algorithms are from this category.

### Reinforcement Learning

The third type of algorithm that can be classified as unsupervised algorithms are the one called reinforcement learning. In this type of algorithm, a machine (actually its controlling program) is trained to make a specific decision, and the machine is based on the current position (the set of available variables) and the allowed actions (e.g. move forward, move back and…), he makes a decision that in the first times, this decision can be completely random and for every action or behavior that he shows, the system gives him a feedback or a score and based on this feedback, the machine realizes that it has made the right decision or not to repeat the same action or try another action and behavior in the next time in that situation. Due to the dependence of the current state and behavior on previous states and behaviors, the Markov decision process can be one of the examples of this group of algorithms. Neural network algorithms can also be considered from this category. The meaning of the word “strengthening” in the naming of these algorithms also refers to the feedback stage that strengthens and improves the performance of the program and algorithm.

## The main algorithms of machine learning

- Linear regression
- logistic regression
- decision tree
- SVM
- Naive Bayes
- KNN
- K-Means
- Random forest
- Dimensionality reduction algorithms
- Gradient Boost & Ada Boost

## Types of supervised learning machine learning problems

### 1) Regression problems

Consider the example of house price forecasting. This example is a regression problem. In this category of problems, we predict continuous values. You might say to yourself that the price of a house is a discrete value. Yes! It is. We round the house prices to the nearest whole number. So, it can be said that the prices are discrete numbers.

The important thing to note is that we draw these discrete numbers on a graph as real and scalar numbers. So our behavior, in this case, is continuous with these behavior numbers and the **machine learning algorithm** aims to find a continuous value for the price of a new house with the help of regression.

### 2) Classification issues

Supervised learning by classification in classification problems, we always deal with discrete values and we want to predict a discrete value: zero or one, benign or malignant. Classification problems are not always between two states. Sometimes you have several different modes to choose from. For example, breast cancer can be considered that there are three types of cancer. In this case, the algorithm must choose between the discrete values of zero, 1, 2, or 3. Zero is for the state that the person does not have cancer, and the other three states are for different degrees of cancer.