Algorithm Design: From Traditional to Machine Learning
26/06/2023 2023-06-29 13:15Algorithm Design: From Traditional to Machine Learning
Algorithm Design: From Traditional to Machine Learning
Edited by Pier Giuseppe Giribone
In the previous article in this column, we discussed the difference between Artificial Intelligence (AI) and Machine Learning (ML), explaining why the latter could be considered a special case.
In this second article, we will try to provide a definition of Machine Learning and clarify the main differences in operation between a traditional algorithm and one designed according to modern learning paradigms.
Intuitively, Machine Learning encompasses the science (and art) of programming a computer so that it can autonomously “learn” from data.
Historically, this concept had already been expressed in visionary terms in 1959 by the American computer scientist Arthur Lee Samuel, who defined ML as that field of study that gives computers the ability to learn without being explicitly programmed.
In 1997, scientist Tom Michael Mitchell provided a more technical and, in a sense, more precise definition of machine learning: “A computer program is said to learn from experience E with respect to some assigned task T and some measure of performance P, if his performance to complete the task T, measured by P, gets better with experience E".
This definition, which may not be immediately intuitive, certainly deserves a clarifying example.
We are generally familiar with the software that allows us to manage email and, in particular, we know what is meant by “spam filter” (i.e. the algorithm that uses modern artificial learning paradigms to filter out unwanted emails).
This is a typical Machine Learning (ML) program that, given examples of emails considered spam (marked by the user himself) and/or received emails considered regular (those not unwanted but to which the user has replied), can autonomously learn to automatically mark an email as spam.
The examples the system uses to learn define the training set. Each data set provided for training is called a training instance or sample.
In this case, according to the definition provided by Mitchell, it could be said that the task T for the spam filter is to flag a new email as unwanted, the experience E It is given by training data and performance P, which measures the level of learning, can be defined, for example, as the percentage of emails correctly classified by the system.
An algorithm that has a large amount of data at its disposal, but is not assigned a specific objective and a related performance metric with which to measure over time how efficiently it is achieving convergence, cannot be considered a program that works following the Machine Learning paradigms.
If you were to download a static copy of Wikipedia to a PC, the computer would have a huge amount of information and data, but since this data isn't managed or organized, it wouldn't generate any new knowledge. What kind of tasks would the software learn to do better? Simply programmatically downloading a copy of an encyclopedia doesn't constitute machine learning.
To understand the design difference between a traditional algorithm and one that implements machine learning paradigms, let's put ourselves in the shoes of a developer who intends to write the logic for the above-mentioned spam filter program.
The traditional algorithmic approach would involve a flowchart containing the following instructions:
- I) Consider all the elements that typically characterize spam. For example, you might notice recurring words/phrases in the email subject line, including "4U," "credit card," and "free." You might also notice other potentially useful patterns in the email address or body.
- II) A detection algorithm would be written for each of these patterns that emerged in the previous analysis, and the software would flag spam emails if a certain number of these patterns were detected.
III) The program will be tested and I) and II) will be repeated until the algorithm has achieved satisfactory performance.
It is clear that since it is a complex problem, the program will be characterized by a very long list of rather complex rules to maintain efficiently.
An ML-based spam filter automatically learns which words and phrases are good predictors of spam by detecting unusual patterns that distinguish unwanted emails from legitimate ones, based on comparisons made in the training set.
The program will thus be leaner, easier to maintain, and more likely to be accurate.
What might happen if a spammer reports that all emails containing "4U" are blocked? They might simply start typing "For U." A spam filter that uses traditional programming techniques should be updated with a new rule that also blocks "For U" emails.
If the spammer detects our filtering system as inadequate, we should constantly define and add new rules.
Unlike traditional programming approaches, a spam filter based on machine learning techniques automatically has the ability to notice that the words “For U” have become unusually frequent among those marked as spam by the user and take action accordingly.
The algorithm will therefore automatically start flagging this type of email without manual user intervention: it has learned a new rule, guided by user experience.
The use of ML algorithms is therefore particularly interesting in solving complex problems, for which the rules governing the system to be represented cannot be defined a priori.
Having understood what is meant by Machine Learning and the main differences in algorithmic design between a traditional program and one dedicated to machine learning, the next article will focus on the classification of the different types of Machine Learning based on the different types of learning.
Arthur Lee Samuel, a pioneer in the fields of artificial intelligence and computer games, coined the term “machine learning” in 1959. He successfully created the first machine-learning-based checkers program, providing an early demonstration of the fundamental concepts of artificial intelligence.