Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NYC Taxi Fare Prediction

A neural network model for predicting New York City taxi fares using geospatial and temporal feature engineering.

Built as a final project for CAP4770 (Introduction to Data Science), this project uses the Kaggle NYC Taxi Fare Prediction dataset to achieve a validation MAE of ~$1.98.

Features

  • Data Pipeline: Cleans outliers, validates coordinates, and filters trips outside NYC bounding box
  • Feature Engineering: Haversine distance calculation, KMeans location clustering (5 zones), peak hour detection
  • Visualization: Interactive Folium maps, density heatmaps, temporal trend analysis
  • Neural Network: TensorFlow/Keras model with early stopping and adaptive learning rate

Tech Stack

  • Data: Pandas, NumPy
  • Visualization: Matplotlib, Seaborn, Folium
  • ML: scikit-learn (preprocessing), TensorFlow/Keras (model)

Getting Started

Prerequisites

  • Python 3.x
  • Jupyter Notebook or JupyterLab

Installation

pip install pandas numpy matplotlib seaborn folium scikit-learn tensorflow

Usage

  1. Download training data from Kaggle
  2. Place train.csv in ./new-york-city-taxi-fare-prediction/
  3. Run the notebook:
jupyter notebook Main.ipynb

Model Architecture

Input (17 features) --> Dense(128, ReLU) --> Dense(64, ReLU) --> Output(1)

Features used: distance, pickup/dropoff clusters, hour, weekday (one-hot), month (one-hot), is_peak_hour, passenger_count

Training: Adam optimizer, MAE loss, early stopping (patience=5), learning rate reduction on plateau

Results

Metric Value
Validation MAE $1.98
Training Samples ~800K (after cleaning)
Test Split 20%

Project Structure

CAP4770-Final_Project/
├── Main.ipynb                              # Main analysis notebook
├── new-york-city-taxi-fare-prediction/     # Data directory (gitignored)
│   └── train.csv                           # Kaggle dataset
├── .portfolio/                             # Project documentation
│   ├── architecture.md                     # System design and diagrams
│   ├── stack.md                            # Technology decisions
│   └── qa.md                               # Q&A knowledge base
└── README.md

Visualizations

The notebook includes:

  • Pickup/dropoff density heatmaps
  • Interactive cluster maps with Folium
  • Fare trends by hour and day of week
  • Distance vs fare scatter plots
  • Correlation heatmaps
  • Monthly fare trends by year

Author

Jacob Kanfer - GitHub

About

Neural network that predicts NYC taxi fares. CAP4770 final project.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages