-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_qualifying_features.py
More file actions
55 lines (46 loc) · 2.04 KB
/
Copy pathdebug_qualifying_features.py
File metadata and controls
55 lines (46 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Debug: Check if lap-level qualifying features are in the data loaded for training
"""
import os
os.environ['STREAMLIT_SERVER_HEADLESS'] = 'true'
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from raceAnalysis import load_data, get_data_fingerprint, CACHE_VERSION, DATA_DIR
print("Loading data...")
data, _ = load_data(10000, CACHE_VERSION, get_data_fingerprint()['data_sha256'])
print(f"Data shape: {data.shape}")
print(f"Columns: {len(data.columns)}\n")
# Check lap-level qualifying features
lap_level_features = [
'best_sector1_sec', 'best_sector2_sec', 'best_sector3_sec',
'theoretical_best_lap', 'actual_best_lap',
'lap_time_std', 'sector1_std', 'sector2_std', 'sector3_std',
'avg_sector1_sec', 'avg_sector2_sec', 'avg_sector3_sec',
'primary_compound', 'theoretical_gap',
'total_qualifying_laps', 'valid_laps', 'deleted_laps'
]
print("=== LAP-LEVEL QUALIFYING FEATURES IN DATA ===")
for feat in lap_level_features:
if feat in data.columns:
non_null = data[feat].notna().sum()
pct = (non_null / len(data)) * 100
print(f"✓ {feat:30s} - {non_null:5d} rows ({pct:5.1f}%)")
else:
print(f"✗ {feat:30s} - NOT IN DATA")
# Check if they're in the feature list
print("\n=== CHECKING FEATURES LOADED FROM FILE ===")
from raceAnalysis import load_f1_position_model_features
numerical_features, categorical_features = load_f1_position_model_features()
print(f"Loaded {len(numerical_features)} numerical features from file")
print(f"Loaded {len(categorical_features)} categorical features from file")
lap_in_numerical = [f for f in lap_level_features if f in numerical_features]
print(f"\nLap-level features in numerical_features: {len(lap_in_numerical)}")
if lap_in_numerical:
for f in lap_in_numerical:
print(f" - {f}")
lap_in_categorical = [f for f in lap_level_features if f in categorical_features]
print(f"\nLap-level features in categorical_features: {len(lap_in_categorical)}")
if lap_in_categorical:
for f in lap_in_categorical:
print(f" - {f}")