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.
- 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
- Data: Pandas, NumPy
- Visualization: Matplotlib, Seaborn, Folium
- ML: scikit-learn (preprocessing), TensorFlow/Keras (model)
- Python 3.x
- Jupyter Notebook or JupyterLab
pip install pandas numpy matplotlib seaborn folium scikit-learn tensorflow- Download training data from Kaggle
- Place
train.csvin./new-york-city-taxi-fare-prediction/ - Run the notebook:
jupyter notebook Main.ipynbInput (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
| Metric | Value |
|---|---|
| Validation MAE | $1.98 |
| Training Samples | ~800K (after cleaning) |
| Test Split | 20% |
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
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
Jacob Kanfer - GitHub