The case
The store wants to know who will cancel. Nobody wrote that rule.
Isaac's store has forty thousand customers, and it wants to warn, before it happens, who is about to stop buying. The team tries rules by hand: "customer who hasn't bought in 60 days". The rule catches a few cases and misses many others. A model, trained on the purchase history, finds patterns nobody listed.
This post builds on Data and Analytics on Google Cloud. To train a model, you need organized data, and the previous post shows where that data lives and how it is queried.
The problem
Hand-written rules don't keep up with customers
A fixed rule only covers what someone thought to write. Every customer who buys in a different way asks for a new exception, and the list keeps growing.
Don't mix them up
AI, ML and generative AI
These terms appear together, but they are not synonyms. Each one sits inside the previous one.
| Term | What it is | Example at the store |
|---|---|---|
| AI (artificial intelligence) | Any system that performs tasks that would require human intelligence | An assistant that answers questions about the order |
| Machine learning | AI that learns patterns from data, without rules written by hand | Predicting who will cancel the subscription |
| Deep learning | Machine learning with neural networks in many layers, for images, voice and text | Recognizing the product in a photo the customer sent |
| Generative AI | Models that create new content (text, images, code) from a request | Writing a product description from its features |
How the model learns
Three ways to learn
Supervised
The examples come with the right answer, like a history of customers marked "cancelled" or "stayed". Used to classify and predict.
Unsupervised
There is no ready answer. The model looks for similar groups on its own, like customers who shop on the same days and categories.
Reinforcement
The model acts, gets a reward or a penalty, and adjusts its behavior. For example, testing price ranges and keeping the one that brings the most profit.
From data to prediction
The life cycle of a model
- Collect and clean the data. Wrong or incomplete data gives wrong predictions, however sophisticated the model is.
- Split training and test data. One part teaches the model; the other part, kept aside, shows whether it works on cases it has never seen.
- Train. The model adjusts its parameters to make fewer mistakes on the training data.
- Evaluate and publish. If the result on the test data is good, the model goes into use.
- Monitor. Customer behavior changes, and a model that worked can start to fail. It needs new data and new training.
On the cloud
Use a ready model or train your own
Ready model, through an API
You call an AI service over the internet, without training anything. It is the fastest path, and the bill comes from usage.
Your own model
You bring your data and train a model for your problem. It requires good data and time to train and evaluate.
Training infrastructure
Training models needs specialized processors (GPUs and TPUs), rented by the time used and expensive per hour.
Key terms
Five terms to remember
Tap a card to see the definition.
Quick test
Three questions, exam style
01
The store has a history of customers marked 'cancelled' or 'stayed' and wants to predict the next case. What kind of learning is this?
02
The store wants to group similar customers, without knowing beforehand which groups exist. What kind of learning is this?
03
A demand forecasting model worked well in 2025, but it makes more mistakes in 2026 because customer behavior changed. What should you do?
AI and machine learning show up in every cloud exam. The name of the service changes from one provider to another; the idea of training on data, evaluating on new cases and monitoring the result is the same.