Machine learning: when should you use it?

Adevinta
Adevinta Tech Blog
Published in
7 min readDec 3, 2021

José Antonio Díaz, Backend engineer

Machine learning (ML) is a technology that has been on the rise for a while. There are many production services and solutions based on ML and many top dogs in the IT world have it in their toolkit. In Adevinta, we have built a lot of ML solutions for our marketplaces, including personalised searches, ad recommenders, scam and fraud detectors. But the question I’m raising here is: when should you use ML?

This post is aimed primarily at people who want to know which tasks can be solved by ML and enthusiasts who have learned (or want to learn) ML and are looking for a problem to solve with it.

Image by pixabay

What is artificial intelligence and machine learning?

According to Wikipedia, “Artificial intelligence (AI) is intelligence demonstrated by machines, as opposed to natural intelligence displayed by animals including humans. […] Any system that perceives its environment and takes actions that maximize its chance of achieving its goals”. Also “Machine learning (ML) is the study of computer algorithms that can improve automatically through experience and by the use of data. It is seen as a part of artificial intelligence”.

For me, the best example to use when talking about artificial intelligence is Dr Nim, a toy from the 60s, designed to play the game of Nim perfectly. Dr Nim won’t hesitate to capitalise on your mistakes and win if you make as much as a single error. This is a very simple implementation of artificial intelligence, basing the moves of the machine on the moves made by the player. For a closer look into the toy, Stand up Maths does an excellent job of explaining and exploring it in depth.

Dr Nim, by John Thomas Godfrey, ESR 1963

This is what we mean when we refer to intelligence in machines, the ability to adapt their behaviour based on their environment. However, ML solutions can only do this for one specific task at a time. This is known as Artificial Narrow Intelligence (ANI), or weak AI. ML does not try to mimic or replicate general human intelligence. It just focuses on finding patterns in the input data or its environment to optimise itself and compute its best possible result.

Over the last years, the rise of ML-based solutions is largely due to its many supporting resources. There are multiple tutorials and courses about building ML solutions and hundreds of research papers on the latest algorithms and techniques. You’ll also find plenty of tools available to develop ML models, with excellent documentation and functionality, like SciKit Learn, Tensorflow, Keras, or PyTorch. More recently, we’ve seen the appearance of ML Ops technologies, like Metaflow, that helps deliver ML solutions to production.

What types of problems does machine learning solve?

To answer this question, we can divide tasks into three types:

  • Static: tasks that require the same method or procedure to achieve the desired result, where the “rules of the game“ never change. For these tasks, using the same method will always produce the same outcome. These tasks include things like sorting the contents of a folder alphabetically, sending an email or controlling the heating of a house.
  • Dynamic: tasks that require a method or procedure that adapts to the environment to achieve the desired result, where the rules of the game can change. For these tasks, the environment or the desired outcome itself can change. Examples of dynamic tasks include things like auditing a house or a car, finding the best movie for a specific occasion or figuring out a good diet or exercise routine.
  • Creative: tasks where figuring out new concepts or ideas is the desired result, where you don’t follow the rules of a game but create them yourself. For these tasks, the environment and the outcome are not perfectly defined and are often subjective. These tasks include things like researching a new medicine, designing a public park or creating artistic works, such as songs or illustrations.
Types of tasks diagram

Traditionally, machine-based solutions were only capable of solving static problems, but with the emergence of AI techniques, machines can now tackle many kinds of dynamic tasks. And this is where ML truly shines.

Essentially, all ML solutions boil down to identifying patterns in the data to arrive at a conclusion, which is also how humans tackle these types of changing problems: learn about the environment, figure out general rules and guidelines and then adjust them when necessary.

As long as there is enough good quality data and the problem is well defined, ML algorithms can adapt to almost any environment and produce good results. There are some scenarios nowadays where ML is the mainstream solution, like fraud detection or computer vision for cars. It is also a very strong contender in many areas of software development that deal with dynamic tasks, like content personalisation and recommendation, data processing and analysis, language comprehension and even security and cryptography.

What’s more, ML’s usefulness doesn’t stop there. ML can also solve static tasks that are too complex or too costly for normal algorithmic solutions. Examples of this are the adoption of Neural Networks in the best chess engine in the world or ML’s use in optimising routes and forecasting obstacles in applications like Google Maps.

Is machine learning capable of solving creative tasks?

If you’ve browsed the internet in search of AI or ML related topics, you’ve probably seen people using ML to create music, stories or screenplays. My favourite without a doubt is this screenplay for Batman written by a bot which is hilarious (there is even a comic and video rendition). If you fancy experimenting with this concept, there are ready-to-use tools available, like NovelAI.

These solutions exist thanks to the huge advances made in Deep Learning, a subset of ML dealing with very complex problems. And if you look at what these tools can do, you might think that ML is all-powerful and able to tackle even the most creative of tasks. If not today, maybe in time with better algorithms or techniques.

Unsplash

I would argue that this is not the case.

It’s important to realise that these tools, although impressive and an achievement in their own right, are not truly solving creative tasks. They are solving very complex dynamic tasks. An ML musician can create wonderful pieces of music based on others, but it will never come up with a new genre or style it hasn’t listened to before. An ML writer may have perfect grammar, structure and meaning, but will only write about the topics it has learned. An ML painter will be fast and competent at drawing and copying great works of art, but will never try to deviate from that and evolve a style of its own.

Making new things can be largely based on existing ones, but there is an essential part to being creative that Artificial Narrow Intelligence lacks: inspiration. Nevertheless, according to Thomas Edison: “Genius is one percent inspiration and ninety-nine percent perspiration. Great accomplishments depend not so much on ingenuity as on hard work.” Even if ML cannot be a solution on its own, it can be valuable support. There are many examples of ML solutions with an assisting role in creative tasks. For example, ML can help doctors make diagnoses by finding symptoms and anomalies in clinical tests, it can also assist tools in writing to double-check grammar, spelling and even tone, such as Grammarly, or it can help with translator tools that try to handle context, meaning and nuances, like DeepL.

ML tools help in these creative tasks by taking care of preprocessing data, discovering important information, finding anomalies or making a basic draft. This leaves people free to focus on the creative part of the job and make the best decisions they can. I think this is one of the better and more virtuous uses for ML.

Conclusion

You can think of ML as a useful tool for three kinds of tasks:

  • Specific tasks that are too big or complex for traditional algorithms to be an efficient solution.
  • Dynamic tasks that require the solution to be flexible and adapt to the current environment.
  • Assisting people in creative work by offloading specific tasks or generating drafts.

As long as the problem is well formulated, well defined, solvable, and you have enough data, ML can be a good solution. Just make sure you are not over-engineering something simple that can be solved trivially, unless that’s exactly what you want to do. I tried to code a graphics engine from scratch, I’m not even close to being able to judge.

--

--

Adevinta Tech Blog
Adevinta Tech Blog

Published in Adevinta Tech Blog

Read stories from our engineers and discover how Adevintans are making an impact in our online marketplaces around the world. #BeTheChange

Adevinta
Adevinta

Written by Adevinta

Creating perfect matches on the world’s most trusted marketplaces.

No responses yet