Skip to content
Ethan CharpentierPortfolio

2025

TARDIS — Train Delay Prediction & Dashboard

A data science project analyzing SNCF train delay data, building a predictive regression model, and shipping an interactive Streamlit dashboard.

Role
Developer
Tags
data-science, python, machine-learning, streamlit, data-viz
Team
  • Noah Savoye — Developer
  • Matthieu Coraleau — Developer
TARDIS — Train Delay Prediction & Dashboard — hero image

A full data pipeline built for a fictional SNCF Data Analysis Service: clean and explore historical train delay records, train a regression model to forecast delay duration, and surface it all through an interactive Streamlit dashboard travelers could actually use to plan their journeys.

The problem

Raw delay data is messy and, on its own, useless to a commuter — missing values, duplicate entries, inconsistent types, and no structure that ties a delay to when or where it's likely to happen. The task was to turn that raw CSV into three things: a clean dataset with meaningful engineered features, a regression model that actually beats a naive "predict the mean delay" baseline, and a dashboard that makes both the insights and the predictions accessible to a non-technical user.

What We did

  • Built a full cleaning and feature-engineering pipeline in tardis_eda.ipynb: handled missing values and duplicates, fixed data types, and engineered temporal features (day of week, hour, peak-hour flags) alongside delay categories, exporting the result to cleaned_dataset.csv.
  • Ran exploratory analysis with pandas/seaborn/matplotlib — summary statistics, delay distributions, and comparisons across stations and times of day — to surface which factors actually correlate with delays before touching any model.
  • In tardis_model.ipynb, encoded categorical features (station, train type, day of week) and trained multiple regression models — a linear baseline and tree-based models (e.g. Random Forest / Gradient Boosting) — comparing them on RMSE, MAE, and R².
  • Selected the best performer, applied hyperparameter tuning, documented the trade-offs, and serialized the final model with joblib for reuse outside the notebook.
  • Built tardis_dashboard.py with Streamlit: delay distribution charts, a summary-stats panel (average delay, total trips, punctuality rate), station-level comparisons, a correlation heatmap, and a prediction interface where users input journey parameters and get a live delay estimate with the model's feature importances shown alongside it.
  • Kept the whole codebase ruff-formatted and split cleanly across the required deliverables (EDA notebook, modeling notebook, dashboard script, README).

Outcome

An end-to-end pipeline — from a messy CSV to a live, interactive prediction tool — that outperforms the mean-delay baseline and turns historical SNCF-style delay data into something a traveler could genuinely use to plan around late trains.

  • TARDIS — Train Delay Prediction & Dashboard — gallery image 1
  • TARDIS — Train Delay Prediction & Dashboard — gallery image 2