stratascratch
  • Interview Questions
    • Interview Loops
    • Analytical
    • Algorithm
    • ML Coding
    • Stats Coding
    • Visualization
    • Concept
  • Data Labs
    • Discover
    • Your Notebooks
  • Mock Interview
  • Learn
  • Blog
  • Pricing
  • About
Log in
  • Interview Questions

    • Interview Loops
    • Analytical
    • Algorithm
    • ML Coding
    • Stats Coding
    • Visualization
    • Concept
  • Data Labs

    • Discover
    • Your Notebooks
  • Mock Interview
  • Learn
  • Blog
  • Pricing
  • About
Log inSign up
Back to Mini Analyses
  1. Assignment
  2. Your Solution
  3. Solution
  4. Solutions from Users
  5. Discussion

Near-Miss Event Rates

You must be logged in to download the datasets

Waymo: Count near-miss events in test-drive logs and report how often they happen per 1,000 autonomous miles in each city.

Assignment

The safety testing team runs a staged test program in Phoenix, San Francisco, and Los Angeles. The test routes include planned traffic situations, such as vehicles cutting in, sudden braking ahead, and pedestrians crossing, so close encounters are much more frequent than in normal service. The team shared two exports: the list of test drives with their miles, and the sensor frames recorded around each close encounter with another road user. They want to know how often the autonomous system has a near miss in each city.

Note: Time to collision (TTC) is the number of seconds until the vehicle would reach an object if both kept their current speeds. The team treats a TTC below 1.5 seconds, for an object in the vehicle's path, as a near-miss warning. They have no fixed rule yet for which objects count as being in the path, or for when several warning frames belong to the same event, so choosing these definitions is part of the task.

Deliverables

  • The number of near-miss events on autonomous drives, and the rate per 1,000 autonomous miles for each city and for all cities together.
  • For each event, the lowest TTC reached and how long the TTC stayed below 1.5 seconds.
  • Your definition of an object in the path and of one event, and how the event count and the rates change under other reasonable definitions.
  • A short closing report of your findings for the safety testing team, including which city has the highest rate, how sure you are about the differences, and anything they should double-check before relying on the numbers.

Definitions.

  • TTC =distance to the objectclosing speed= \dfrac{\text{distance to the object}}{\text{closing speed}}=closing speeddistance to the object​
  • A near-miss event is one encounter in which the TTC to an object in the vehicle's path falls below 1.5 seconds.

Data Description

waymo_test_drives.csv has one row per test drive:

  • drive_id
  • miles
  • mode - autonomous (the autonomous system drives) or manual (the safety driver drives)
  • city

waymo_drive_frames.csv has one row per sensor frame (one snapshot of an object that the sensors track), for the seconds around each close encounter:

  • drive_id
  • timestamp
  • object_id - the identifier the tracking system gives to the detected object
  • distance_m - distance to the object along the vehicle's path, in meters
  • closing_speed_mps - speed at which the distance to the object is shrinking, in meters per second
  • lateral_offset_m - distance of the object from the center line of the vehicle's path, in meters; the sign shows the side

Practicalities

You can solve this in Python, SQL, or a mix of both — StrataScratch notebooks support both languages in the same notebook.

Assume this data comes directly from the vehicle logs and hasn't been cleaned, so review it carefully before relying on the numbers. When something looks off, work out what it is and decide how to handle it; when a definition or a final decision is genuinely ambiguous, choose a reasonable option and explain why. There's often more than one valid way to compute a result, so explain the approach you take and the reasoning behind your choices.

What's assessed: your results, and how clearly you explain what you see in the data and justify the choices you make.

This question is part of an interview loop

See the full interview round by round, with questions for each stage.

Waymo · Data ScientistAutonomous vehicles & robotics · Data Scientist