AI Weather Forecasting System uses machine learning to predict temperature, humidity, and precipitation for Nairobi, Kenya. It preprocesses historical weather data, trains a multi-output random forest model, and visualizes actual vs predicted results.
# AI Weather Forecasting System π¦οΈ
AI Weather Forecasting System uses machine learning to predict temperature, humidity, and precipitation for Nairobi, Kenya. It preprocesses historical weather data, trains a multi-output Random Forest model, and visualizes actual vs predicted results.
---
## π Dataset
* Source: Collected from a weather monitoring service
* Period: **May 14, 2024 β May 14, 2025**
* File: `nairobi_weather_data.csv`
---
## π Objective
Predict the following weather parameters:
* Maximum Temperature (`tempmax`)
* Minimum Temperature (`tempmin`)
* Humidity (`humidity`)
* Precipitation (`precip`)
---
## π§ Model & Features
* **Algorithm**: Random Forest Regression with `MultiOutputRegressor`
* **Language**: Python 3
* **Libraries**: `pandas`, `scikit-learn`, `matplotlib`, `numpy`
* **Features Used**:
* Dew Point (`dew`)
* Wind Gust (`windgust`)
* Wind Speed (`windspeed`)
* Cloud Cover (`cloudcover`)
* Solar Radiation (`solarradiation`)
---
## π Features
* Cleans and preprocesses historical weather data
* Predicts multiple weather variables (tempmax, tempmin, humidity, precip)
* Uses a Random Forest regressor for robust predictions
* Visualizes actual vs predicted values for easy comparison
---
## π Results
| Metric | tempmax | tempmin | humidity | precip |
| ------------ | ------- | ------- | -------- | ------- |
| **RΒ² Score** | 0.65 | 0.46 | 0.80 | -0.03 |
| **RMSE** | 2.10Β°F | 2.16Β°F | 4.04% | 0.12 in |
π Precipitation was challenging to predict due to dataset variability.
---
## πΌοΈ Sample Output
---
## π Project Structure
* `weather_forecast.py` β Main ML script (for automation)
* `weather_forecast.ipynb` β Notebook version for step-by-step exploration
* `nairobi_weather_data.csv` β Cleaned historical weather data
* `forecast_plot.png` β Output graph of actual vs predicted results
---
## π» Requirements
* Python 3.x
* pandas
* scikit-learn
* matplotlib
* numpy
Install dependencies using:
```bas β¦