4th Ave Train Spotter
We got tired of being caught by the train. So, we coded a solution.
If you live, work or perhaps occasionally traverse the Wedgewood-Houston neighborhood, a train has surely crossed your path. Two very busy CSX lines run right through the heart of WeHo, crossing 4th Avenue South and, a few meters further north, Chestnut Street.
There’s never a good time to be stopped by one. But, trains are likely to show up  when you’re late for work or transporting a kidney or ice sculpture. We feel your pain.
The Cohub office is located immediately adjacent to the tracks. We watch those big boys roll by all day long. We’ve had missed meetings, lunches delivered an hour late, even had a job prospect climb through an open box car because a train had parked itself right across 4th and Chestnut.
The source of all this car/train conflict lies a little over four miles to the south. There sits Radnor Yard , an enormous parcel of Nashville real estate where CSX assembles and dispatches freight trains to locations far away.
To be fair, the trains were here long before folks like us moved in. Still, it would be great if CSX just told us when their trains would be coming through. But, I doubt even they know with any useful degree of foresight when a given train will be crossing 4th Ave, much less how long it’ll be botching up schedules for drivers. These trains tote freight, not passengers. Coal doesn’t care if it’s five hours late.
It might not seem like it, but having watched the rail activity for a couple of years now, CSX really does do its best to play nice. But, they can only do so much given the nature of the situation and the transportation volume. Expect more delays as the convergence of rail cars and road cars grows steadily with all the new Nashville traffic load.
Our Solution

Cohub solves tough business problems with code. This train thing is a tough problem, so we coded a solution. It's called the 4th Ave Train Spotter and it's free for everyone to use.
Try out the browser version here. Or, download the mobile app from the Apple App Store for iPhone (iOS) or Google Play for Android. When asked if you will accept notifications, we suggest that you allow them. You may want to disable them later, but for now it's better to turn them on.

Tap “peek under the hood” to see a few of the numbers we use to determine if a train is present. Each street has two variables that represent the probabilities that a crossing gate has been lowered or that a train is present. When these probabilities exceed certain thresholds, the circle changes color and we send a notification that a gate has lowered or that a train is present.

“4th Train P:” indicates the probability (expressed as a percentage) that a train is present at the 4th Avenue crossing. “4th Signal P:” tells you the probability that the gate has lowered across the road. It’s the same for the Chestnut Street figures. If the CSX warning system is working properly, you’ll always see Signal P rise before the Train P.

How it Works

This can get complicated, as it involves concepts like deep learning and neural networks. No need to go into all that here. If you want more detail, see Using CNNs to Improve Local Traffic Flow. The important thing to know is that we study data collected from when trains are present and when trains aren’t and create statistical models to represent these situations. Then, we compare data from what’s going on right now with the statistical models. The comparison tells us with a very high degree of confidence when an intersection is blocked.


While the system is extremely accurate, it does have a few limitations.

False positives: These notification errors happen when we mistakenly think that a train is near or is present. It doesn’t happen often as the model is quite good at avoiding them. However, it can be fooled by things like a trash truck that empties dumpsters near the tracks in the wee morning hours. As the model gains more experience, however, we should be able to minimize these kinds of errors.

Pseudo-false positives: Or, should they be called “false false positives”? Doesn’t really matter. The point is that this happens when the gate drops, we send a notification, yet there’s no train present. It seems like the prediction is wrong. Actually, the system's working as expected.

While a train typically follows a lowered gate, that’s not always true. A gate across the road means “none shall pass”, train present or not. There are times where a train triggers a gate activation, but parks just short of the crossing. That’s CSX doing us a solid. And, if technicians are working on the gate system, they often test it a few times to be sure it’s working properly.

False negatives: These happen when there is a train present, but we didn’t detect it and failed to notify the app. The false negative, with our model, is more rare than the already rare false positive. But when it happens, it’s far more annoying. They happen, for example, when an unusual kind of train rolls by that the model wasn’t taught to recognize. Even in that case, a false negative is typically prevented by the detection of a lowered gate, one of the reasons they’re so rare.

Bad weather: Extreme weather can result in both false positives and negatives. We train the model for these situations, but in the worst cases there just isn't enough data to make a prediction and the false negative will rear its ugly head. Of course if the weather’s that bad, you probably won’t be driving.

Equipment or software failure: The system has several dependencies. Sensing devices, evaluation computers, software code, electric service, internet service, cloud providers, etc -- all these need to be working. If any one of them fails, the app will fail to notify you. We lower the risks with power backups, cloud based systems, and the like. But, if a tornado crosses our path or if our ISP goes down, down goes the Train Spotter.

Excessive Notifications: The system sends notifications whenever there’s a train present. That means you’ll get a bunch of them because the trains here run frequently. You can turn them off, but be aware that you’ll need to have the app open to know if a train is present. To enable or disable notifications:

  • iPhone (iOS):
    Settings > Train Spotter > Notifications 
  • Android:
    Settings > Apps & Notifications > Notifications > All Apps > Train Spotter
Despite this list of limits, the system is anything but limited. When one of these problems pop up, we can usually pound it back down with a statistical cudgel or two. The vast majority of the time, the 4th Ave Train Spotter is correct.

Questions and Suggestions

We’d love to hear from you. Email us at info@cohub.com. If you like the app, please give us a good rating. If you don’t, let us know why and we’ll do our best to fix it.

It is indeed true that we built the 4th Ave Train Spotter to make traffic (and life) a bit more pleasant for everyone here in our fair city. It’s our little gift to the citizens of Nashville.

It’s also true that we’re parading around our programming plumage to demonstrate how Cohub solves difficult operational problems for business. If you, or someone you know, could benefit from our services, please let us know. We’d be grateful.