Predicting the rest
of a bus journey.
Given where a bus is now and how it has been moving, can a small model estimate how many minutes remain?
Explore a recorded journey ↓Why I started here
I was exploring better arrival information for trotros and school transport in Ghana. Before building a tracking app, I wanted to test the prediction itself.
This first experiment uses public bus journeys from Brazil. It tests minutes to a recorded endpoint. A Ghana pilot is still needed.
Follow the bus. Compare the estimate.
Choose a model and move through a journey. The recorded outcome lets you see where the estimate succeeds and where it misses.
Historical route diagram. The complete path is shown for context; future positions are excluded from prediction inputs. The destination is assumed known before departure.
Lower average error. Still room to improve.
| Model | Mean error | Error averaged per journey | Within 2 minutes |
|---|
What improved
Adding past movement history brought Plus mean error down from 5.88 to 4.67 minutes on the same test journeys. The updated random forest reached 5.50 minutes.
What this does not settle
The speed baseline gets more estimates within two minutes. Random forest had lower validation error than Plus. The ranking changes across splits, and 11 test journeys are a small sample.
Accuracy has a waiting time.
Fast reduced warm prediction latency by about 18% compared with Plus in this run, with a higher mean error.
| Model | Fit | Batch: 362 rows | First single row | Warm single row |
|---|
TabPFN runs through the API; random forest runs locally. Timings include network overhead. Warm latency is the median of two calls, so these measurements are preliminary.
What went into the prediction?
The experiment is reproducible. Both result exports include the predictions behind the tables.
The task and the inputs
Predict minutes until the final recorded GPS point. Inputs include current position, a known destination, elapsed time, recent speed, past distance traveled, stops, and time of day. Full-trip duration, speed and ratings are excluded. A recorded endpoint may not be a bus terminal.
Training, validation and testing
All observations from a journey stay in one partition. The 30 training journeys were divided into 22 fitting journeys and eight validation journeys for choosing prediction settings. Models were then refitted on all 30 training journeys and evaluated on the 11 test journeys. Learned models use the same movement-history features.
The original test results had already been inspected before this experiment. The rerun is exploratory. New journeys and repeated trip-level evaluation are needed before making a general performance claim.
What a transport app would still need
Live location, route destinations, and new local journey data would be needed to test this in Ghana. School transport would also need separate boarding, pickup and safety systems. This prototype evaluates arrival prediction only.