Problem #188
Author:Daniel Ion
Difficulty
Your best score
N/A
SafeDrive Technologies, a pioneering company in the field of automotive safety, is developing an intelligent disaster prevention system for modern vehicles. With the increase in incidents caused by overheating and gas leaks, the company needs a Fire Distinguisher - an AI system capable of detecting dangerous anomalies in real-time and classifying them correctly.
You are the Lead Machine Learning Engineer. Your task: to build the detection system that can save lives.
The data comes from sensors mounted in experimental vehicles, collected at 1-second intervals:
id: ID associated with the recordgas_raw: Raw gas concentration detectedtemp_c: Temperature in degrees Celsiusflame: Binary flame sensor (0 = absent, 1 = present)gas_avg: Moving average of gas concentrationtemp_avg: Moving average of temperaturedGas: Rate of gas changedTemp: Rate of temperature changesensor_noise: Noise introduced by the sensortimestamp_ms: Unix timestamp in millisecondssensor_id: Sensor ID (S001-S005)battery_level: Sensor battery levelvehicle_speed: Vehicle speedweather_condition: Weather condition (sunny, rainy, cloudy, foggy)gas_sensor_drift: Gas sensor driftambient_temp: Ambient temperaturelabel: Hazard type
train.csv: Training data with all columns (including label)test.csv: Test data without the label columnThe safety team wants to understand the distribution and characteristics of hazards in the training data.
Your task: For train.csv, calculate the following 12 statistics:
Output: 12 numerical values (4 percentages + 4 average temperatures + 4 average gas concentrations).
Example: For NORMAL: 45.32% of readings, average temperature 32.5°C, average gas 245.3
The safety team wants to identify abnormal readings that could indicate dangerous situations. Normal readings form a pattern in the feature space — your task is to measure how far each test reading is from this pattern.
1. Select the most relevant features
NORMAL=0, GAS_LEAK=1, OVERHEAT=2, FIRE=3)2. Prepare the data
3. Define the NORMAL profile
label == "NORMAL" from train to establish what "normal behavior" means4. Calculate the anomaly score
d = sqrt((x - mu)^T * Sigma^(-1) * (x - mu))
mu = mean vector of NORMAL recordsSigma = covariance matrix of NORMAL recordsSigma_reg = Sigma + I * 1e-6, where I is the identity matrixOutput: The anomaly score for each ID in test.csv.
Example:
2,5234,8.922,6567,1.232,7891,14.45Hint: In Python:
scipy.spatial.distance.mahalanobis()or manual calculation with numpy.
The raw score obtained is not easily interpreted by the field team. Transform it into risk categories (LOW/MEDIUM/HIGH) using thresholds based on historical data.
1. Calculate thresholds based on train
p33 and p662. Classify each test reading
| Condition | Risk Level | Interpretation |
|---|---|---|
d < p33 | LOW | Near-normal behavior |
p33 ≤ d < p66 | MEDIUM | Slight anomaly |
d ≥ p66 | HIGH | Significant anomaly |
Output: The risk level for each ID in test.csv.
Example:
3,5234,HIGH3,6567,LOW3,7891,HIGHCORE MISSION! This is the brain of the Fire Distinguisher system. Every second, hundreds of vehicles transmit data, and your system must decide instantly: is everything normal or is there a danger? A mistake in fire detection can cost lives. SafeDrive counts on you to build the most accurate classifier possible.
Your task: For each record in test.csv:
label_name (NORMAL / GAS_LEAK / OVERHEAT / FIRE)Output: The predicted label (NORMAL, GAS_LEAK, OVERHEAT, or FIRE) for each test reading.
| Subtask | Score | Criterion |
|---|---|---|
| 1 | 20 | All values correct |
| 2 | 15 | Proportional to the percentage of correct scores (tolerance ±0.05) |
| 3 | 15 | Proportional to the percentage of correct risk levels |
| 4 | 50 | Weighted Multi-Class F1-Score: • F1 ≥ 0.90 → 50 points • F1 < 0.60 → 0 points • Intermediate values → linear. |
Final score: 100 points maximum.
submission.csv)Structure: subtaskID,datapointID,answer
| subtaskID | datapointID | answer |
|---|---|---|
| 1 | 1-12 | [Statistic values] |
| 2 | [ID from test.csv] | [Anomaly score: e.g., 8.92] |
| 3 | [ID from test.csv] | [Risk level: LOW/MEDIUM/HIGH] |
| 4 | [ID from test.csv] | [Label: NORMAL/GAS_LEAK/OVERHEAT/FIRE] |
Details:
Subtask 1: 12 rows with fixed statistics
Subtask 2: N rows
id from test.csvSubtask 3: N rows
id from test.csvLOW, MEDIUM, or HIGH)Subtask 4: N rows
id from test.csvNORMAL, GAS_LEAK, OVERHEAT, FIRE)