time predictions view - VforVitorio/F1_Strat_Manager GitHub Wiki

Time Predictions View

VforVitorio/F1_Strat_Manager

powered by

Devin

Time Predictions View

The Time Predictions View is a component of the F1 Strategy Manager that visualizes the comparison between predicted and actual lap times for selected drivers. This documentation explains how the view is implemented, its visual components, and its integration with the underlying prediction models.

For information about the lap time prediction model implementation, see Lap Time Prediction.

Purpose

This component allows race strategists to:

  1. Visualize predicted vs. actual lap times for any driver
  2. Evaluate prediction accuracy through error metrics
  3. Identify laps with significant prediction errors
  4. Understand performance trends to inform strategy decisions

Component Architecture

The Time Predictions View connects the lap time prediction model with the Streamlit dashboard interface, transforming prediction data into actionable visualizations.

Core Implementation

The component is implemented through the render_time_predictions_view function, which generates three main visualization elements:

Visualization Components

The Time Predictions View generates three main visual elements:

1. Mean Absolute Error (MAE) Metric

A single numeric value that quantifies the overall prediction accuracy. Lower values indicate better prediction performance.

2. Top Errors Table

A tabular display showing the 5 laps with the largest prediction errors, helping identify specific problematic predictions.

Lap Real Lap Time Predicted Lap Time Absolute Error
24 84.234 85.012 0.778
42 85.121 84.452 0.669
18 83.998 84.567 0.569
36 85.765 85.254 0.511
11 84.321 84.789 0.468

3. Comparison Chart

An interactive Plotly line chart that shows real and predicted lap times across all laps, enabling visual analysis of trends and patterns.

Data Requirements

For proper functioning, the Time Predictions View requires a DataFrame with the following columns:

Column Description Type
DriverNumber Car number of the driver integer
LapNumber Sequential lap number integer
LapTime Actual recorded lap time float (seconds)
PredictedLapTime Model-predicted lap time float (seconds)

The view automatically calculates the AbsError column as the absolute difference between actual and predicted lap times.

Prediction Model Integration

The view displays predictions generated by the lap time prediction model. The prediction pipeline involves:

Key features used for prediction include:

  • Tire compound and age
  • Speed at various track segments
  • Historical data from previous laps
  • Sequential features capturing trends

Integration with Other Views

The Time Predictions View is part of the Streamlit dashboard and works alongside other components in the F1 Strategy Manager:

The prediction data can also be included in strategy reports via the report export functionality.

Practical Usage

When using the Time Predictions View:

  1. Select a driver from the dashboard
  2. The view automatically filters prediction data for that driver
  3. Review the MAE to assess overall prediction quality
  4. Examine the top errors table to identify specific problematic laps
  5. Analyze the comparison chart to detect patterns or trends in performance
  6. Use these insights to inform race strategy decisions

The view is particularly valuable for:

  • Validating the prediction model's reliability
  • Understanding how different race conditions affect performance
  • Identifying unexpected performance changes that may require strategy adjustments
  • Providing data-driven support for strategic decisions

On this page