Overview
The F1 ML Prediction System exposes 7 REST API endpoints for race predictions, driver comparisons, and race simulations. All endpoints return JSON responses and use GET requests with query parameters. Base URL:http://localhost:5000
Winner Prediction V2
Query Parameters
Starting grid position (1-20). Lower numbers indicate better starting positions.
1= Pole position2-10= Top 1011-20= Back of grid
Weather conditions for the race.
DRY- Sunny/dry conditionsLIGHT_RAIN- Light rainHEAVY_RAIN- Heavy rain/storm
Starting tire compound.
SOFT- Fast but high degradation (0.08 sec/lap)MEDIUM- Balanced performance (0.05 sec/lap)HARD- Slow but consistent (0.03 sec/lap)
Circuit type/characteristics.
STANDARD- Standard racing circuitSTREET- Street circuit (Monaco, Singapore)FAST- High-speed circuit (Monza, Spa)DESERT- Desert circuit (Bahrain, Saudi Arabia)TECHNICAL- Technical circuit
Response
Probability of finishing in top 3 (0.0 to 1.0)
Human-readable prediction result.
"Top-3 Likely"if probability > 0.5"Top-3 Unlikely"if probability ≤ 0.5
Contextual insights based on input parameters and predicted probability.
Example Response
Lap-by-Lap Race Simulation
Query Parameters
Starting weather conditions.
DRY- Dry conditionsLIGHT_RAIN- Light rainHEAVY_RAIN- Heavy rain
Circuit type.
STANDARD- Standard circuitSTREET- Street circuitFAST- High-speed circuitDESERT- Desert circuit
Response
Name of the race winner
Array of driver results (all 20 drivers)
Total number of DNFs in the race
Array of lap numbers where safety car was deployed
Array of [lap, weather] tuples showing weather changes throughout the race
Example Response
2026 Season Prediction
This endpoint requires
season_2026_calendar.py to be run first to generate the prediction data file.Query Parameters
None - this endpoint takes no parameters.Response
Championship standings for all drivers
Results for all races in the 2026 season
Example Response
Error Response
Driver Comparison
This endpoint requires
driver_stats_real.py to be run first to generate the comparison data.Query Parameters
Three-letter driver code for first driver.Available drivers: VER, LAW, HAM, LEC, NOR, PIA, RUS, ANT, ALO, STR, GAS, DOO, SAI, ALB, OCO, BEA, TSU, HAD, HUL, BOR
Three-letter driver code for second driver.
Response
First driver’s full name
Second driver’s full name
First driver’s team
Second driver’s team
Array of statistic category names: [“Wins”, “Podiums”, “Poles”, “Championships”, “Wet Wins”, “Street Wins”]
Array of numeric values for driver 1 corresponding to categories
Array of numeric values for driver 2 corresponding to categories
Total career races for driver 1
Total career races for driver 2
Win rate percentage for driver 1
Win rate percentage for driver 2
Career points total for driver 1
Career points total for driver 2
Human-readable summary of driver 1’s career
Human-readable summary of driver 2’s career
Name of driver with more career wins
Example Response
Error Response
Feature Importance
Query Parameters
None - this endpoint takes no parameters.Response
Array of feature names sorted by importance (highest to lowest)
Array of importance scores (0.0 to 1.0) corresponding to features
Example Response
Race Simulation
Query Parameters
Weather conditions affecting race randomization.
DRY- Standard simulationRAIN- Increased randomization
Response
Array of driver codes in finishing order (1st to 20th)
Array of position numbers corresponding to drivers
Example Response
Championship Simulation
Query Parameters
None - this endpoint takes no parameters.Response
Championship standings after 5 races
Three-letter code of the championship winner