Top machine learning algorithms


With the evolution of artificial intelligence, computer science researchers are constantly suggesting new approaches to make computers even more autonomous and capable of performing tasks with precision.

For this reason, the use of Machine Learning algorithms to solve complex problems has increased. Among its benefits is the ability of machines to learn without being explicitly programmed for a certain activity.

In this article, I will introduce the 3 main approaches to machine learning: supervised, unsupervised, and reinforcement. In addition, I will briefly explain how the main machine learning algorithms work, showing examples of use cases.

What is Machine Learning?

Traditionally, programmers have always developed systems by specifying each step in code, clearly. For this, software engineers needed to know well the problems they were trying to solve and to have a good idea of ​​all the variables and possibilities involved.

Machine Learning (ML) is a subfield of artificial intelligence that aims to solve more complex problems, of which programmers still do not have such a broad knowledge.

It also applies when it is not feasible to map all variables and possibilities. For this purpose, systems are encouraged to solve problems autonomously, learning about them and proposing a way out.

In this context, algorithms analyze input data, process and predict possible outputs within a defined range. In the process, they try different approaches and optimize their ability to get the result.

Artificial systems in ML go through two phases: training and execution . In the first, they are fed by an input set so that they are contextualized with the specific situation that involves the problem.

Then, in the second stage, they start to deduce the paths from what they learned in the previous stage. These two phases vary depending on the type of algorithm, as we will see later in this article.

Although not new, Machine Learning is a field of knowledge in development, that is, it gains new approaches and new models frequently. These evolutions seek to solve problems even more precisely and offer special options for each tool to adapt to the specific problem.

Machine Learning Methods

Next, we will discuss the main ML methods and their characteristics.

supervised learning

Supervised learning is useful in cases where a property (label) is available for a given dataset (training set). All inputs and outputs are known, but need to be predicted for other instances.

Then, these data are passed to the learning system, which has the function of discovering paths and adjusting its own model to reach the expected results.

A practical example would be teaching a machine to recognize and categorize emails, separating those that are relevant from those that are SPAM.

In the training phase, samples of both cases are transmitted to the algorithm, since the two blocks of information are fully known. In the execution phase, the system will have the ability to determine whether or not a new email is an unwanted message.

That is, the software already knows which inputs are associated with which outputs, but it needs to learn a way to understand this association.

In this process, he tries to identify patterns and establish predictions that help to optimize the approach. This model has this name because it is as if the human operator were always assisting the system, teaching it in a direct way.

The results of this type of algorithm are usually marked as classification and regression. The first concerns a way of mapping the same elements into specific categories, as in the example above, “spam” and “not spam”. The second consists of identifying a trend for the data that even allows for predicting the future based on historical data.

A common application is in the security sector, with the use of tools to identify suspicious behavior on a network and ensure protection against attacks.

unsupervised learning

In unsupervised learning, the challenge is to discover relationships implicit in a set of unlabeled data. In this way, the algorithm is in charge of identifying patterns to label the data.

A very common example is the company that provides a set of customer data as the basis for an ML system and expects it to identify possible common attributes and behavior patterns to create specific and segmented offers. In the beginning, the company does not know the information well enough to know the possible exits.

It's like learning without human assistance, with the system dictating the paths to follow. In this algorithm model, the common strategies are clustering and dimension reduction.

Approaches like these can be used in recommender systems, where, based on collaborative or specific information, software can filter ideal content among a myriad of them.

It is widely used in e-commerce stores to recommend products that may be of interest to the customer who visits the site. Similarly, there are streaming services that suggest songs or videos that a user should watch. Both Netflix and Amazon use this approach to create their recommendation algorithms.

Reinforcement learning

In this learning method, which follows the style used at the beginning of studies on Artificial Intelligence, the computer is encouraged to learn based on trial and error, optimizing the process in direct practice. With this approach, it is possible, for example, to teach a system to prioritize habits over others, with rewards proportional to success.

Reinforcement learning was inspired by behavioral psychologists, who believed in the effectiveness of rewards and punishments in educating human beings. It also reminds you of the procedure for training domestic animals.

It is a method, therefore, based on the construction of experience. From this, the algorithm knows which paths are better than others and which processes are more agile.

Examples of application are autonomous vehicles and machines that play chess. The system learns from multiple trials, which involve mistakes such as a bad move or crashing into an obstacle.

What are the main machine learning algorithms?

There are a multitude of algorithms used in machine learning, each with a specific purpose.

There are also characteristics that can make it impossible to choose the most accurate model for a given problem, such as the use of high computational power.

Algorithms for supervised learning

What it is : An algorithm uses training data and feedback from humans to learn the relationship of data inputs to a given output (for example, how inputs “time of year” and “interest rates” predict housing prices).

When to use : When you know how to sort input data and the type of behavior you want to predict, but you need the algorithm to calculate it on new data.

1. Linear regression

Highly interpretable standard method for modeling the past relationship between independent input variables and dependent output variables (which can have an infinite number of values) to help predict future values ​​of output variables.

Example use cases :

  • Understand the drivers of product sales, such as competitive pricing, distribution, advertising, etc.
  • Optimize price points and estimate the price elasticity of products.

2. Logistic regression

Extension of linear regression that is used for sorting tasks, meaning the output variable is binary (eg, just black or white) rather than continuous (eg, an infinite list of potential colors).

Example use cases :

  • Rank customers based on how likely they are to repay a loan;
  • Predict whether a skin lesion is benign or malignant based on its characteristics (size, shape, color, etc).

3. Linear/quadratic discriminant analysis

Updates a logistic regression to handle nonlinear problems – those where changes in the value of input variables do not result in proportional changes in output variables.

Example use cases :

  • Predict customer turnover;
  • Predict the probability of closing a sales lead.

4. Decision tree

Highly interpretable classification or regression model that splits data feature values ​​into branches at decision nodes (e.g. if a feature is a color, each possible color becomes a new branch) until a final decision output is made .

Example use cases :

  • Provide a decision framework for hiring new employees;
  • Understand the attributes that make a product more likely to be purchased.

5. Naive Bayes

A classification technique that applies Bayes' theorem and allows the probability of an event to be calculated based on knowledge of the factors that can affect that event (e.g. if an email contains the word "money", then the probability of being spam is high).

Example use cases :

  • Analyze sentiment to assess the perception of the product in the market;
  • Create classifiers to filter spam emails.

6. Support Vector Machine

A technique that is normally used for classification, but which can be transformed to also perform regressions. The algorithm draws an ideal division between the classes (the widest possible). It can also be quickly generalized to solve nonlinear problems.

Example use cases :

  • Predict how many patients a hospital will need to serve in a given period;
  • Predict the likelihood that someone will click on an online ad.

7. Random Forest

A classification or regression model that improves the accuracy of a single decision tree by generating multiple decision trees and selecting the most votes to predict the outcome, which is a continuous variable (e.g. age) for a regression problem and is a discrete variable (eg, black, white, or red) for classification.

Example use cases :

  • Forecast the volume of calls in call centers to generate decisions related to the service team;
  • Predict energy use in an electrical distribution network.

8. AdaBoost

A classification or regression technique that uses a multitude of models to arrive at a decision, but weights them based on their accuracy in predicting the outcome.

Example use cases :

  • Detect fraudulent activity in credit card transactions. Achieve lower accuracy than deep learning;
  • Simple and low-cost way to classify images (eg recognize land use from satellite imagery for climate change models). It also achieves lower accuracy than deep learning.

9. Trees with gradient increase

A classification or regression technique that generates decision trees sequentially, where each tree focuses on correcting errors arising from the previous tree model. The final result is a combination of the results of all trees.

Example use cases :

  • Forecasting product demand and stock levels;
  • Predict the price of cars based on their features (eg age and mileage).

10. Simple neural network

Model in which artificial neurons (software-based calculators) form three layers (an input layer, a hidden layer where calculations take place, and an output layer) that can be used to sort data or find the relationship between variables in regression problems.

Example use cases :

  • Predict the likelihood of a patient joining a health care program;
  • Predict whether or not registered users will be willing to pay a certain price for a product.

Algorithms for unsupervised learning

What it is: An algorithm mines input data without being given an explicit output variable (for example, it mines customer demographics to identify patterns).

When to use: You don't know how to sort the data and you want the algorithm to find patterns and sort the data for you.

11. K-means Clustering (clustering)

Puts the data into several groups (k), each containing data with similar characteristics (as determined by the model, not in advance by humans).

Example use cases :

  • Segments customers into groups by different characteristics (eg age group) to better designate marketing campaigns or avoid churn.

12. Gaussian mixture model

A generalization of k-means clustering that provides greater flexibility in the size and shape of clusters.

Example use cases :

  • Segment customers to better attribute marketing campaigns using less distinct customer characteristics (eg, product preferences);
  • Segment employees based on the likelihood of attrition.

13. Hierarchical grouping

Divides or aggregates clusters along a hierarchical tree to form a classification system.

Example use cases :

  • Group loyalty card customers into progressively more micro-segmented groups;
  • Inform product usage/development by grouping customers who mention keywords in social media data.

14. Recommendation system

Uses cluster behavior prediction to identify the important data needed to make a recommendation.

Example use cases :

  • Recommend which movies consumers should watch based on the preferences of other customers with similar attributes;
  • Recommend news articles that a reader might want to read based on the article they are reading.

How to choose the ideal algorithm?

As there are several ways to reach a result with ML, as there are several approaches, it is necessary to know how to choose the most appropriate algorithm for the proposed problem. We will see some tips below.

Purpose of the problem

It is important to know well the purpose and context of the case that must be processed by the machine, with specific details, as they help to select the best way to handle the data.

If there is a well-defined objective, with known outputs, the ideal may be a supervised learning method. Within this approach, if the result is a numerical value, it is possible to use regression. If they are categories, classification.

amount of data

Another relevant aspect is the amount of data that will be used to feed the software. Neural networks, for example, often need large input sets.

It is important to know well and stick to the size of the bases to establish which method to follow, as each one deals with the amount in a different way. In addition, if the database is very large and the algorithm is too complex, it may be necessary to evaluate the computational capacity needed to execute the algorithm.

Problem complexity and accuracy

The complexity of the problem is also an important issue, as this determines the degree of accuracy desired. With this, it is possible to select which algorithm best fits this degree of precision by analyzing factors such as the danger of an error and the consequences they can bring.


And finally, time must be taken into account. There are problems that will require real-time decisions. Others, however, with an acceptable range. This should be considered when choosing the type of ML that best solves the case.

Final considerations

In this article, we have seen how Machine Learning solutions differ and are classified into three major major categories and smaller sub-categories. Each has its own character and nature.

Therefore, it adapts to specific problems of special contexts. To select the algorithm that best solves your case, it is necessary to analyze some factors, such as: complexity, time and amount of data.

Post a Comment

Previous Post Next Post