← Back to Live Forecast
🛰️ AI-Powered Meteorological Prediction Engine
Localized Machine Learning Forecasting Station for Metuchen, NJ
1. The High-Level Architecture
The program is built on a Three-Tier Architecture that ensures the system remains autonomous and self-correcting:
- Data Tier (Ingestion): Connects to Open-Meteo API using requests-cache. It fetches both 3 years of Historical "Truth" and a 10-day "Future" forecast.
- Logic Tier (Intelligence): Utilizes a dual-model approach:
- Random Forest Regressor: Predicts the intensity of precipitation.
- Logistic Regression: Predicts the probability of rain/snow events.
- Presentation Tier (UI): A Flask-based web server that renders dynamic Matplotlib charts and customizes units for the end-user.
2. The Data Flow & Logic Engine
| Stage |
Process |
Technology |
| Training |
Learns local patterns (Temp, Humidity, Pressure) from 2023–2025. |
scikit-learn |
| Inference |
Applies learned patterns to the 240-hour forecast window. |
Random Forest |
| Transformation |
Calculates Snow Ratio (10:1) and converts Metric to Customary units. |
Pandas / NumPy |
| Validation |
Logs "Predicted vs. Actual" to SQLite for error tracking. |
SQLite3 |
3. Key Design Features (The "Why")
- Lag Features: The model uses "Weather Memory"—it looks at the conditions from one hour ago to understand the trajectory of a storm, not just a single snapshot.
- Snow-Switch Logic: A software "gate" monitors temperature; at < 33.8°F, it triggers the snow accumulation algorithm.
- Self-Correction: By calculating the Mean Absolute Error (MAE), the system provides a transparency score, telling the user exactly how much to trust the model today.
4. Technical Stack Summary
- Languages: Python 3.11
- Database: SQLite3
- Deployment: Debian Linux virtual machine
- Web Application Framework: Flask
💡 Feedback Loop
The program doesn't just "guess" and forget; it writes its guess to a database and checks back later to see if it was right. This process of continuous monitoring and logging is the essence of Machine Learning Operations (MLOps).