Pit-Lane-Project / backend /docs /feature-contract.md
Interact-ai's picture
Upload folder using huggingface_hub
267266e verified
|
Raw History Blame Contribute Delete
7.38 kB

Telemetry-to-model feature contract

Audit boundary

The repository contains the current compressor, current feature engineer, saved schema JSON, and saved model bundle. It does not contain the original 54-column CSV, its header, the original offline compressor source, or a separate original feature-engineering source file. Therefore the exact names of all 54 source columns cannot be proven from the available artifacts. Do not infer the four unused names.

To finish that historical part of the audit, provide either the original CSV header (a header-only file is sufficient) or the original 1.66 GB CSV, plus the original compressor/training script or notebook. The large CSV can be inspected with pandas.read_csv(..., nrows=0) and sampled in chunks; it does not need to be loaded into memory.

The saved bundle and JSON independently agree on the exact 39 ordered raw model features. The bundle's preprocessor also records the same input order and emits 85 processed features.

Available 54-to-50 evidence

ORIGINAL_RAW_COLUMN_COUNT records a historical count of 54. The current compressor consumes these 50 unique raw columns, in contract order:

RPM, Speed, nGear, Throttle, Brake, DRS, X, Y, Z,
DistanceToDriverAhead, AirTemp, TrackTemp, Humidity, Pressure,
WindDirection, WindSpeed, Date, SessionTime, Time, Distance,
RelativeDistance, DriverAhead, TrackStatus, Driver, DriverNumber, Team,
LapNumber, Stint, Compound, TyreLife, FreshTyre, LapTime, Sector1Time,
Sector2Time, Sector3Time, Sector1SessionTime, Sector2SessionTime,
Sector3SessionTime, SpeedI1, SpeedI2, SpeedFL, SpeedST, IsPersonalBest,
Position, PitInTime, PitOutTime, LapStartTime, LapStartDate,
DifferentialDistance, Rainfall

The names of the other four original columns are unavailable. SessionStatus, CurrentLap, and TotalLaps are live lifecycle inputs only; they are not among the 50 compressor inputs and are not model features.

Lap compression

Each completed driver lap produces _RaceDate, Driver, LapNumber, and TelemetryRecords, followed by these aggregated columns:

  • Arithmetic mean of all finite numeric samples: RPM_Mean, Speed_Mean, nGear_Mean, Throttle_Mean, Brake_Mean, DRS_Mean, X_Mean, Y_Mean, Z_Mean, DistanceToDriverAhead_Mean, AirTemp_Mean, TrackTemp_Mean, Humidity_Mean, Pressure_Mean, WindDirection_Mean, WindSpeed_Mean.
  • Sum of all finite numeric samples: DifferentialDistance_Sum.
  • Last non-None sample: Date_Last, SessionTime_Last, Time_Last, Distance_Last, RelativeDistance_Last, DriverAhead_Last, TrackStatus_Last, Driver_Last, DriverNumber_Last, Team_Last, LapNumber_Last, Stint_Last, Compound_Last, TyreLife_Last, FreshTyre_Last, LapTime_Last, Sector1Time_Last, Sector2Time_Last, Sector3Time_Last, Sector1SessionTime_Last, Sector2SessionTime_Last, Sector3SessionTime_Last, SpeedI1_Last, SpeedI2_Last, SpeedFL_Last, SpeedST_Last, IsPersonalBest_Last, Position_Last, PitInTime_Last, PitOutTime_Last, LapStartTime_Last, LapStartDate_Last.
  • Maximum of all finite numeric samples: Rainfall_Any.

_RaceDate is the date portion of the last Date, or the current UTC date when no usable date is present. Driver is the uppercased last driver value. LapNumber is numeric. Empty laps and laps without a driver or lap number fail.

Exact ordered 39-feature model input

# Model feature Compressed source / formula Aggregation
1 Driver Driver last valid, uppercased
2 LapNumber LapNumber last/current completed lap
3 DriverNumber DriverNumber_Last last valid
4 RPM_Mean RPM_Mean mean
5 Speed_Mean Speed_Mean mean
6 nGear_Mean nGear_Mean mean
7 Throttle_Mean Throttle_Mean mean
8 Brake_Mean Brake_Mean mean
9 DRS_Mean DRS_Mean mean
10 X_Mean X_Mean mean
11 Y_Mean Y_Mean mean
12 Z_Mean Z_Mean mean
13 DistanceToDriverAhead_Mean same mean
14 AirTemp_Mean same mean
15 TrackTemp_Mean same mean
16 Humidity_Mean same mean
17 Pressure_Mean same mean
18 WindDirection_Mean same mean
19 WindSpeed_Mean same mean
20 DifferentialDistance_Sum same sum
21 Distance Distance_Last last valid
22 RelativeDistance RelativeDistance_Last last valid
23 DriverAhead DriverAhead_Last last valid, category
24 TrackStatus TrackStatus_Last last valid, numeric
25 Stint Stint_Last last valid
26 Compound Compound_Last last valid, uppercased
27 TyreLife TyreLife_Last last valid
28 FreshTyre FreshTyre_Last last valid
29 SpeedI1 SpeedI1_Last last valid
30 SpeedI2 SpeedI2_Last last valid
31 SpeedFL SpeedFL_Last last valid
32 SpeedST SpeedST_Last last valid
33 IsPersonalBest IsPersonalBest_Last last valid
34 Position Position_Last last valid
35 Rainfall Rainfall_Any maximum / any-rain indicator
36 TyreLifeSquared TyreLife ** 2 derived
37 TrackAirTempDifference TrackTemp_Mean - AirTemp_Mean derived
38 WindX WindSpeed_Mean * cos(radians(WindDirection_Mean)) derived
39 WindY WindSpeed_Mean * sin(radians(WindDirection_Mean)) derived

Missing values and validation

  • Raw numeric None, non-numeric, NaN, and infinity values are ignored by numeric aggregation. An aggregate with no finite values becomes None.
  • Last-value aggregation skips None. A non-finite numeric last value is later converted to None by feature engineering.
  • Derived features become None when any required input is missing.
  • Missing DriverAhead or Compound becomes UNKNOWN. A missing driver fails inference.
  • The saved local preprocessor median-imputes numeric missing values, most-frequent-imputes actual missing categorical values, and one-hot encodes categories with unknown categories ignored. Remote models must implement the same training-time preprocessing semantics when receiving JSON null.
  • Schema loading fails unless raw_feature_count is exactly 39. Every local, remote, or auto inference call fails before prediction unless each row has exactly the saved 39 names in the saved order. The model bundle, schema, and preprocessor input order are also compared during local model loading.

Real-data validation status

No old telemetry CSV or other real telemetry sample is present in the project or the inspected project/user data locations. Consequently a real-lap chunked end-to-end prediction could not be run in this audit. The focused tests exercise the identical compressor-to-feature-to-saved-model path with bounded synthetic lap samples. Once the source CSV is provided, select training drivers from the saved encoder (for example VER, HAM, or NOR), stream chunks, retain only a few complete (Driver, LapNumber) groups, and pass those groups through the same three production services.