Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Uber Trip Data Analysis and Prediction

Predicting Uber trip mileage and cost using machine learning, with a full pipeline from raw trip logs to trained models and visualized results.

Course project for ICS474: Big Data Analytics, KFUPM (Fall 2024).

Overview

This project explores a real Uber trip dataset to answer three questions:

  • Mileage prediction — how far will a trip go, based on its features?
  • Cost estimation — what will a trip cost, using a distance-based formula?
  • Data insights — what patterns and correlations show up in the data?

Two models are trained and compared: Linear Regression and Random Forest Regressor. The pipeline covers data preprocessing, feature engineering, model training, evaluation, and visualization end to end.

Dataset

UberDataset.csv contains trip-level records, including:

  • Start and end timestamps (START_DATE, END_DATE)
  • Miles traveled (MILES)
  • Trip purpose (PURPOSE)
  • Categorical fields: CATEGORY, START, STOP

Preprocessing steps:

  • Fill missing PURPOSE values with Unknown
  • Parse date columns to datetime and derive trip duration
  • Drop rows with invalid or missing dates
  • One-hot encode categorical variables
  • Split into training (80%) and testing (20%) sets
  • Standardize features with StandardScaler

Results

Random Forest Regressor:

Metric Value
MAE 4.91
MSE 195.73
RMSE 13.99
0.74

Visualizations produced by the notebook:

  • Correlation heatmap — relationships between numeric and one-hot encoded features (e.g. MILES vs. trip duration)
  • Predicted vs. actual cost scatter plot — accuracy of cost predictions against a perfect-prediction diagonal
  • Log-scaled trip duration histogram — distribution of trip lengths
  • Miles boxplot — outlier detection

Cost model: Cost = $0.50/mile + $2 base fare (a simple baseline — future work below covers refining it).

Requirements

pandas
numpy
matplotlib
seaborn
scikit-learn
joblib

Install with:

pip install pandas numpy matplotlib seaborn scikit-learn joblib

Running it

  1. Clone this repository.
  2. Make sure UberDataset.csv is in the same directory as the notebook.
  3. Open and run ICS474proj.ipynb.

The notebook prints preprocessing logs, model evaluation metrics, and renders the visualizations described above.

Future work

  • Add features like time of day or traffic conditions to the cost model
  • Hyperparameter tuning via grid or randomized search
  • Extend to multi-city Uber datasets for better generalization

Files

  • ICS474proj.ipynb — full analysis notebook (preprocessing, modeling, evaluation, plots)
  • UberDataset.csv — source dataset
  • ICS474 - Project.pdf — written project report

Built by Osama Al-Bahnasi.

About

Predicting Uber trip mileage and cost with Linear Regression and Random Forest (KFUPM ICS474 Big Data Analytics project).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages