A transport analyst has access to a massive dataset: millions of GPS coordinates from smartphone apps, combined with local transit schedules, weather feeds, and land-use records. Her goal is to predict what travel mode each user is using (walking, biking, driving, transit) at any given moment.

If she uses a discrete choice model (Post 15), she must manually specify the utility function, define the choice set, and make strict assumptions about how variables interact. If she uses machine learning, she can feed the raw data into a gradient boosting model or a deep neural network, and let the algorithm discover the patterns. The ML model will likely predict mode choices with much higher accuracy. But it raises a critical question: does it explain why people choose those modes?

Machine learning has become a central tool in behavioral modeling. It shifts the focus from explanation to prediction, opening up new capabilities while introducing distinct challenges.

Why Machine Learning Matters for Behavior Modeling

Traditional behavioral models are theory-driven. They start with a hypothesis about human psychology (e.g., the Theory of Planned Behavior) or economic decision-making (e.g., Random Utility Theory), represent that hypothesis in mathematical equations, and fit parameters using data. The goal is to estimate and explain the relationships between constructs: how much does travel time matter compared to travel cost?

Machine learning models are data-driven. They prioritize prediction accuracy. Instead of assuming a specific functional form (like the logit formula), ML algorithms search through high-dimensional data to find the function that best maps inputs to outputs. This makes them highly effective for processing complex, unstructured, and high-frequency datasets — such as smart card taps, GPS trajectories, connected vehicle logs, and social media feeds — where traditional models struggle.

Core intuition: Machine learning excels at prediction and pattern discovery in complex datasets, but it does not inherently represent causal mechanisms. It should be treated as a powerful complement to behavioral theory — useful for predicting outcomes and detecting non-linear interactions, but requiring additional interpretability methods to provide policy insights.

Core Constructs

Prediction vs. Explanation Supervised Learning Feature Importance Segmentation Interpretability Theory-Data Gap
Prediction vs. Explanation

Prediction is the ability to correctly forecast unseen outcomes (e.g., will this driver crash in the next mile?). Explanation is the ability to identify the underlying causal mechanisms (e.g., why do wide lanes increase speed?). ML models prioritize prediction; traditional models prioritize explanation.

Supervised Learning

The ML paradigm where an algorithm learns a mapping from input features (e.g., travel time, gender, rain) to a labeled output (e.g., chose train). Algorithms include Random Forests, Extreme Gradient Boosting (XGBoost), Support Vector Machines (SVM), and Neural Networks.

Feature Importance

Metrics that quantify how much each input variable contributes to the model's predictive accuracy. While feature importance identifies which variables are useful for prediction, it does not specify the direction of the effect or the causal path.

Unsupervised Segmentation

Clustering algorithms (e.g., k-means, latent Dirichlet allocation) that group individuals based on observed patterns without pre-defined labels. Used to identify behavioral "personas" (e.g., transit-dependent riders, choice cyclists) from GPS or smart card history.

Interpretability / XAI

Explainable AI (XAI) tools — such as SHAP (SHapley Additive exPlanations) values or LIME — that calculate how much each feature shifts a specific prediction. XAI is used to look inside "black-box" models to understand their behavioral patterns.

Theory-Data Gap

The risk that a model fits noise or non-causal correlations in a dataset rather than actual human behavior. A model might predict transit use from smartphone battery levels because of household wealth correlations, leading to poor predictions if battery saving behaviors change.

Common ML Approaches in Behavioral Modeling

Causal Logic (Or Lack Thereof)

Standard econometric models assert causality through theory: we assume travel time causes a drop in utility, and we estimate that parameter. Machine learning models do not have built-in theory. The logic is associative:

How ML Learns Behavior

Input Data (Time, Demographics, Weather) → Multilayered Non-linear Transforms → Optimization Algorithm minimizes Prediction Loss → Output Choice predicted.

Behavioral translation: The model learns *patterns*, not *motives*. It discovers that people rarely bike when it rains, but it does not know if this is because of safety concerns, physical discomfort, or lack of gear.

How We Extract Meaning (Post-hoc Interpretability)

Trained ML Model → Perturb Input Features → Observe Shift in Output Probability → Compute SHAP Values → Infer Behavioral Sensitivity.

Policy implication: This allows planners to calculate "marginal effects" similar to choice model elasticities, identifying which attributes represent policy levers for mode shift or safety.

Data Needed

Machine learning is data-hungry. It requires larger, more diverse datasets than traditional survey methods:

Passive Data Streams

Continuous data collected without active user participation: Smart card transactions (tap-in/tap-out), GPS tracking apps, vehicle telematics (speed, braking, acceleration), and Bluetooth detector logs.

High-Dimensional Surveys

Large-scale household travel surveys combined with spatial data (GIS layers for tree canopy, sidewalk width, crime rates, business density) to provide rich features for choice classification.

Unstructured Data

Streetview images (for sidewalk quality assessment), text from public feedback comments, or audio recordings from transit stations, processed via computer vision or NLP to extract behavioral features.

Methods

  1. Random Forests & Gradient Boosting (XGBoost, LightGBM): The most popular ML methods for tabular behavioral data. They excel at handling mixed data types, missing values, and highly non-linear interactions (e.g., travel time only matters if it exceeds 30 minutes).
  2. Deep Neural Networks (DNN): Used for image classification (e.g., pedestrian detection in automated vehicles) and natural language processing of traveler feedback. Deep choice models (DCM-Net) attempt to represent utility functions as neural network layers.
  3. SHAP (SHapley Additive exPlanations): Grounded in cooperative game theory, SHAP calculates the contribution of each feature to the difference between the actual prediction and the average prediction. This provides local interpretability (why did this specific person choose transit?) and global summaries.

Transportation Example: Travel Mode Classification

A city wants to detect travel modes from anonymous GPS tracks to monitor bicycle and transit utilization. Standard rule-based algorithms (e.g., if speed < 15 km/h and acceleration is low, classify as walk) produce high error rates when bicycles travel fast down hills or buses get stuck in traffic.

Features

GPS track segments are converted into features: mean speed, maximum speed, acceleration variance, heading change rate, proximity to transit lines, and local weather.

Model Training

An XGBoost classifier is trained on a labeled dataset (where users logged their actual modes). The model achieves 93% accuracy on test data, compared to 72% for the rule-based approach.

Behavioral Insight

SHAP analysis reveals that "proximity to transit line" is the most important feature for identifying bus riders, but weather (temperature and precipitation) exhibits a strong non-linear threshold effect for cyclists.

XGBoost Accuracy
93%
Rule-Based Accuracy
72%
Logit Model Accuracy
81%
Comparison of classification accuracy for travel mode detection.

In comparative studies (e.g., Hagenauer & Helbich, 2017), machine learning algorithms consistently outperform multinomial logit models in predicting mode choices. However, researchers emphasize that ML’s advantage decreases when the dataset is small or when the primary goal is to compute economic welfare measures, which require the strict utility formulation of discrete choice theory.

Strengths

Handles Complex Interactions

ML models automatically discover non-linear relationships and interactions between variables without the modeler having to specify them in advance.

High Predictive Power

Consistently achieves higher prediction accuracy than traditional choice models, making it the tool of choice for real-time demand forecasting and operations.

Processes Unstructured Data

Can integrate raw images, text feedback, and continuous sensor streams directly into behavioral predictions.

Limitations

Black-Box Risk

Without interpretability layers (SHAP), it is difficult to understand *why* the model makes a prediction. This makes it risky for policy design, where understanding the causal mechanism is essential.

Data Hungry and Overfitting

Requires large datasets to generalize. If trained on small datasets, ML models easily memorize noise, leading to poor predictions in new environments.

Lacks Welfare Foundations

Unlike random utility models, standard ML classifiers do not output consumer surplus or economic welfare metrics, limiting their use in formal cost-benefit analyses.

Best Use Case

Machine learning is the best approach when the primary goal is high-accuracy prediction using large, complex, or passive datasets, such as travel mode detection from GPS tracks, real-time transit demand forecasting, collision risk prediction from vehicle dynamics, and passenger segmentation using smart card histories.

Key takeaway: Machine learning is a prediction engine, not an explanatory framework. While it outperforms traditional models in accuracy, it requires careful pairing with interpretability tools or behavioral theory to generate reliable insights for policy design.

Key References

Foundational references
Exercises and Discussion Questions
  1. A transport consultant uses a deep neural network to predict travel mode choice. The model has 96% accuracy, but the city council asks: "If we increase bus fares by 10%, how many riders will we lose?" Explain why the neural network cannot directly answer this question, and describe how you would use SHAP values to help.
  2. Machine learning models are prone to learning "spurious correlations." Give an example of a spurious correlation that an ML model might learn from a travel survey, and explain why this correlation would lead to policy failures if used by planners.
  3. Compare the data requirements, model building process, and validation methods of a Multinomial Logit choice model (Post 15) and a Random Forest classifier (this post) for predicting cycling adoption. Under what circumstances should a city choose one over the other?