Lesson 4 of 4 AI and ML Fundamentals

Deciding Whether Machine Learning Fits a Problem

This lesson explains how to decide whether a problem needs machine learning and, if it does, how the type of output decides the technique. The exam often presents a business need and asks whether machine learning fits and which approach to take.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the conditions under which machine learning is a good fit.
  • Recognise situations, such as deterministic rules, where machine learning is not the right tool.
  • Explain how AI adds value by assisting decisions, scaling work and automating repetitive tasks.
  • Choose a technique from the type of output a business question requires.

When ML is a good fit

Machine learning learns patterns from examples instead of following rules that a person writes. It is therefore the right tool when the rules are too complex or change too often to write by hand. Nobody can write a complete set of rules for recognising a face in a photo, and fraud patterns change as criminals adapt, but a model can learn both from examples.

Three further conditions must hold. There must be enough relevant, representative data, ideally labelled with the correct answers, because the model can only learn patterns that the data contains. An approximate answer must be acceptable, because a model's predictions are probabilities with a measurable error rate, not certainties. And the value usually comes from scale: ML is most useful when the work is too large or too fast for people to do by hand, such as checking every card payment as it happens.

When these conditions hold, AI adds value in three ways. It assists human decisions, for example by flagging likely fraud for an analyst to review. It scales work that would otherwise need many people, such as reading thousands of documents. And it automates repetitive tasks, such as sorting incoming emails by topic.

Select all that apply

Conditions for ML

Exam skills 1.2.1 · 1.2.2

A company is considering a model to route incoming support tickets to the right team.

Log in to try this activity Interactive activities are free with an account.

When ML is not the right tool

The most common reason not to use machine learning is that the answer is deterministic: fixed rules or a calculation already give the exact, correct result every time. Calculating sales tax, applying a published fee schedule or looking up a price in a database are examples. A model would add cost and the risk of being wrong to a problem that ordinary code solves perfectly.

Machine learning is also a poor choice when there is too little data, or when the data does not contain the signal needed to predict the answer. It should be avoided when every decision must be fully explained and a simpler, transparent method is good enough, which is common in regulated decisions. Finally, it is not worth building when the cost of collecting data, training, running and maintaining the model exceeds the benefit it brings. The following table summarises when ML fits and when it does not.

ML is a good fit when…ML is not the right tool when…
The rules are too complex or change too often to write by handFixed rules or a calculation give the exact answer
Enough relevant, representative data existsThere is too little data, or it lacks the signal
An approximate answer with a known error rate is acceptableEvery decision must be fully explained and a simpler method suffices
The scale makes manual work impracticalThe cost of the model exceeds its benefit
Sort into groups

Model or code?

Exam skills 1.2.2

Decide whether each task is a good use of machine learning or is better solved by rules or a calculation.

Log in to try this activity Interactive activities are free with an account.

Matching the problem to a technique

Once machine learning is the right tool, the technique follows from the type of output the business question needs, as the lesson Matching Business Problems to Machine Learning Techniques and AWS Services explains. A category points to classification, a number to regression or forecasting, groups without labels to clustering, an outlier to anomaly detection, and new text or images to generative AI. The following table maps common business questions to their techniques.

Business questionOutputTechnique
Will this customer leave?A categoryClassification
How many units will we sell next week?A numberRegression / time-series forecasting
Which customers are similar?Groups, no labelsClustering
Is this transaction unusual?Outlier scoreAnomaly detection
What should we recommend?Ranked itemsRecommendation
Write, summarise or answer in natural languageGenerated contentGenerative AI (foundation models)
Worked example

An online retailer's operations manager proposes six machine learning projects: calculating sales tax on each order, flagging unusual card transactions, forecasting next month's demand for each product, grouping customers with similar buying habits, looking up a product's price, and deciding whether an incoming email is spam. Which of them should use machine learning, and with which technique?

The first question for each project is whether a rule or lookup already gives the correct answer. Sales tax follows published rules, and a product's price is stored in a database, so both are deterministic and ordinary code is cheaper, exact and fully explainable. The other four meet the conditions for ML: their patterns are too complex to write down, and the retailer has data that contains the signal. The type of output then decides the technique, as the following table shows.

Business needUse ML?Reason and technique
Calculate sales tax on an orderNoFixed rules give an exact answer
Flag unusual credit card transactionsYesPatterns are complex and change; anomaly detection or classification
Forecast next month's demand for each productYesHistorical data contains the signal; regression or time-series forecasting
Group customers with similar buying habitsYesNo labels exist; clustering (unsupervised learning)
Look up a product's priceNoA database query returns the exact value
Decide whether an email is spamYesLabelled examples exist; binary classification

Exam questions use the same trap: a fixed, well-understood rule is offered alongside machine learning options, and the simplest correct answer is to keep the rule.

Check yourself

When is ML not the right tool?

Show answer

When a fixed rule or formula gives the exact answer, when results must be fully deterministic, or when there is not enough good data to learn from.

Exam Tips

Remember for the exam

  • Use ML when rules are too complex to write, data is available and approximate answers are acceptable.
  • Do not use ML when a deterministic rule or calculation gives the exact answer.
  • Category output: classification. Number: regression. Groups without labels: clustering.
  • Generated text, images or code: generative AI.