Announcing F1-Predictor API ?>

Announcing F1-Predictor API

Since I started this blog, I’m always wondering how I can improve it, what should I write about and how to apply ‘data science’ on anything F1-related. Today, I’m happy to announce that the qualifying and race predictions plus some additional insights (see further down for details) will be exposed via an API and they will be available in JSON format.

The API endpoint can be reached here: http://www.f1-predictor.com/api-next-race-prediction/

The data include the predicted rankings for the next qualifying and race sessions. Perhaps more important is that I also expose the pairwise probabilities i.e. the probability that any driver will start or finish above any other one. This gives you much more insight about the upcoming races. Here’s how part of the JSON data could look like:

{
"race_name": "Canadian GP 2017",
"qualifying": {
    "ranking": {
        "vettel": 1,
        "hamilton": 2
        },
    "pairwise_probabilities": [
        {
        "driver_1": "bottas",
        "driver_2": "alonso",
        "probability": 0.9433226689
        },
        {
        "driver_1": "vettel",
        "driver_2": "hamilton",
        "probability": 0.5835069906
        }]
    },
"race": {
    "ranking": {
        "hamilton": 1,
        "raikkonen": 2
        },
    "pairwise_probabilities": [
        {
            "driver_1": "raikkonen",
            "driver_2": "hamilton",
            "probability": 0.2841115885
        },
        {
            "driver_1": "alonso",
            "driver_2": "vandoorne",
            "probability": 0.7652693776
        }]
    }
}

The qualifying and race rankings are pretty self-explanatory. The pairwise probabilities show the probability of ‘driver_1’ finishing above ‘driver_2’. When calling the API programmatically, you might see the ranking in incorrect order. The number next to each driver is always the predicted ranking no matter who shows first or second in the JSON file. The same applies to the pairwise probabilities. You may see ‘driver_2’ above ‘driver_1’. The respective probability always refers to ‘driver_1’ finishing above ‘driver_2’.

The pairwise probabilities will include all combination of drivers. The race which the data refers to is shown in the ‘race_name’ key. The data will always pertain to the next race and will be updated a few days before the respective event.

The API is open to everyone. If you find or build any application on top of this data, please let me know so I can share it!

Please share the post:

10 thoughts on “Announcing F1-Predictor API

    1. For the moment, no. But you can easily get this information if you parse the JSON. Let me know if you want me to send you sample code doing that.

      Do you think you can use the data from the API to build something?

      1. I don’t have some strict plans now. My application now in the very start phase (structure of DB and basic functionality to upload data from Ergast). But I thinking about to use your data at least at the start, and, maybe, to compare results of models in the future.

    2. Bogdan, I’m actually working on adding other commands to the API. I hope I’ll have it ready in the next few weeks.

    1. Yes, I’m actually working on a more complete API. I was thinking about using the gp-name to get each race’s data. And then, you will also be able to filter quali or race results and even for specific drivers. Would this cover your needs?

      Also, may I ask how you’re using the predictions? 🙂

Leave a Reply

Your email address will not be published.