📘 CodingMarble Learn

AI-Predicted Travel: Using Data to Predict Traffic

To predict traffic, an AI first collects past data, such as cars per hour on many days. It looks for a pattern, like two rush-hour hills in the morning and evening. Then it predicts the next day by using that pattern, for example the average of the same hour on past days. People use the prediction to choose a better time or route. A prediction is a good guess, not a promise.

🎬 Step-by-step story

  1. It is 8 in the morning and the road is packed. Many cars crawl. Nobody knew it would be this slow, so everyone left at the same time.
  2. Before predicting, we collect data. Each bar is the number of cars in one hour. The three colours are three past days. That is our data.
  3. The AI looks for a pattern. The red line joins the averages. It shows two hills: near 8 in the morning and near 6 in the evening.
  4. Now we predict. For tomorrow, each gold bar is the average of the same hour on the three past days. The gold bar near 8 is tall: a jam is expected.
  5. People see the prediction and choose. The green arrow shows leaving at 10 instead of 8. The gold bar is much shorter, so the trip is shorter too.
  6. Your turn. Slide the leaving time. Read the line below the picture: how many cars are predicted and how many minutes the trip will take.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why is the road so slow at 8 am?

Everyone leaves at the same time, so too many cars share one road. The next steps use data to show this.

What is data here?

The bars: counts of cars per hour on three past days. Each colour is one day.

What is a pattern?

Something that repeats. The red line goes up and down in the same way every day: two hills.

How is the gold prediction bar made?

It is the average of the three past bars at the same hour. Add them and divide by three.

Does the AI decide for me?

No. It gives the prediction and you choose. The green arrow marks the time a person chose.

Why can the real trip time still be different?

A prediction is a guess. Accident, rain or road work can change it. Try the slider and treat the number as an estimate.

What does it mean to predict travel?

A prediction is a careful guess about the future, based on facts from the past. For travel we want to guess two things: how crowded the road will be and how long the trip will take.

An AI (artificial intelligence) system can read much more data than a person and notice small patterns we miss.

Data: the facts the AI learns from

Data is a record of facts. For traffic it can be:

More data from many days gives a better picture. Data that is wrong or one-sided gives a wrong prediction.

Finding a pattern and making the prediction

A pattern is something that repeats. Traffic repeats every day: busy at about 8 am and 6 pm, calm at midday.

The simplest prediction is the average of the same hour on past days. For example, if the three past days at 8 am had 90, 96 and 94 cars, then the prediction for tomorrow is (90 + 96 + 94) ÷ 3 = 93 cars.

A real AI uses many more clues (weather, holidays, accidents) and learns how much each clue matters. This is machine learning.

From prediction to a better trip

A prediction is useful only when someone acts on it.

Remember: a prediction can be wrong because of an accident or sudden rain. Good apps keep updating with live data. Also, they should not share where you travel without your permission.

Key formulas and definitions

Worked examples

1. The cars counted at 8 am on three past days were 90, 96 and 94. Predict the count for tomorrow at 8 am.

Average = (90 + 96 + 94) ÷ 3 = 280 ÷ 3 = 93.3. So we predict about 93 cars.

2. Using trip time = 20 × (1 + cars ÷ 50), find the predicted trip time when 100 cars per hour are expected.

Cars ÷ 50 = 100 ÷ 50 = 2. Then 1 + 2 = 3. Trip = 20 × 3 = 60 minutes.

3. At 8 am the prediction is 100 cars (60 min). At 10 am it is 25 cars. How many minutes does leaving at 10 save?

At 10 am: 25 ÷ 50 = 0.5; 20 × 1.5 = 30 minutes. Savings = 60 − 30 = 30 minutes.

Common mistakes

Practice quiz

1. What does the AI collect first to predict traffic?
2. A pattern is something that:
3. Past counts at 8 am were 60, 90 and 120. What is the average prediction?
4. Which action uses a traffic prediction well?
5. A prediction can be wrong because of:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

How does AI predict traffic?

It collects past traffic data, finds patterns such as rush-hour peaks, and uses them (plus clues like weather and holidays) to guess the traffic for the next hour or day.

Why do maps apps know the best time to leave?

They use years of data from many phones and roads and live data right now. They compare predictions for different leave times and show the quickest.

Can an AI traffic prediction be wrong?

Yes. Accidents, sudden rain or road work are not in the past pattern. Good apps update with live data.

Where this is taught

China九年级(初三)Cross-disciplinary theme

Learn first

Learn next

Related lessons

All Computer Science lessons