DeepPort Forecast is an end-to-end Machine Learning Operations (MLOps) project designed to predict whether a maritime container shipment will arrive On Time or Delayed (Binary Classification).
The core value of this system is to function as a proactive Early Warning System, dramatically increasing the detection rate of potential delays (Recall) to minimize associated logistics costs and improve customer trust.
The optimized model (V2) is live and deployed using Docker on Hugging Face Spaces. You can interact with the simulator instantly without any local setup.
How to Use:
- Click the link below to access the live web application.
- The form is pre-populated with a low-risk sample. Click Predict Delay Status to see the baseline output.
- To test the model's true capabilities, input the High-Risk Values (e.g., Vessel Age
$\mathbf{25}$ , Weather Risk$\mathbf{9.0}$ ) and watch the prediction switch to DELAYED.
π Access the Live Simulator Here
This repository contains the full source code for model development (V1 and V2) and the deployed Flask application (/app), demonstrating high proficiency in data science, MLOps, and full-stack integration.
| Metric | V1 (Initial Baseline) | V2 (Optimized Production) | Business Impact |
|---|---|---|---|
| Recall (Delayed) |
|
||
| F1 Score | Highly reliable model for imbalanced data. | ||
| Final Model | Decision Tree | XGBoost | Best performance/speed tradeoff. |
| Deployment | Flask API with optimized |
The repository is structured around the two core functions: Model Training/Versioning and Production Deployment.
.
βββ AI_Model/ # ML Training and Versioning History
β βββ v1/ # Initial Baseline Models (Low Recall)
| βββ ...
β βββ v2/ # Optimized Production Models (High Recall)
| βββ ...
βββ app/ # Flask Web Application (Simulator)
β βββ ...
βββ LICENSE
βββ README.md # This file
βββ ...
βββ requirements.txt # Python dependencies
The AI_Model folder documents the evolution from a baseline academic project (V1) to a robust production system (V2).
- Goal: Establish MLOps framework (ML, DL, Ensemble comparison).
-
Key Insight: Low F1-Score was diagnosed as a technical flaw arising from the inappropriate use of the default
$0.5$ prediction threshold on imbalanced data ($\approx 36%$ delay rate). - Models: Decision Tree, Random Forest, Simple NN, ResNet.
- Methodology: Implemented techniques focused on minimizing False Negatives (missed delays) to save costs.
-
Techniques Implemented:
-
Threshold Calibration: Optimal threshold identified at
$\mathbf{0.316}$ . - Oversampling: Used SMOTE during training to balance class distribution.
- Model Upgrade: Switched best performing model to XGBoost for its superior handling of complex data patterns.
-
Feature Expansion: Created
$>15$ interaction and aggregated risk features.
-
Threshold Calibration: Optimal threshold identified at
-
Result: Recall jumped from
$19.4%$ to$91.1%$ .
The core prediction service is exposed via the Flask web application in the /app directory.
-
Python 3.x
-
Install all required libraries using the
requirements.txtfile.pip install -r requirements.txt
-
Navigate to the
/appdirectory:cd app -
Start the Flask server using Gunicorn (recommended for stable local testing):
gunicorn app:app
-
Access the application at
http://127.0.0.1:5000(or the address specified by gunicorn).
The front-end user experience is built around a complex MLOps workflow running behind the scenes:
- User Input: User submits 25 primary features.
-
Feature Engineering:
utils.pycalculates 8 engineered features (e.g.,port_total_congestion). -
Preprocessing:
preprocessor_optimized.joblibapplies standardization and One-Hot Encoding. - Prediction: The V2 XGBoost model generates the delay probability.
-
Classification: The result is classified as "Delayed" only if the probability
$\mathbf{> 0.316}$ .
- Real-Time Data Integration: Replace simulated data inputs with live data fetched via IMO number using external APIs (AIS, Port Authorities, Maritime Weather).
- Full-Stack Deployment: Integrate this prediction service as the backend for my planned AI-Powered Vessel Tracker and Ship Chandlers E-commerce application.
- Advanced Explainability: Implement SHAP or LIME to provide per-prediction justification on why a ship is likely to be delayed.
Ryan Tusi | AI/ML Engineer + Full-Stack Developer | Software Engineering with Machine Learning Specialization | Codecademy & Harvard Certified
Licensing:
This project is licensed under the Creative Commons. See the included LICENSE file for full details.
