Skip to content

varshinijayaprabhu/ForecastIQ-Weather-Prediction-Tool

Repository files navigation

🌦️ ForecastIQ β€” Weather Prediction Tool

AI-Powered Weather Forecasting with WHO Air Quality Integration

Streamlit App Python scikit-learn XGBoost License

ForecastIQ is an intelligent ML-powered weather prediction platform built with Streamlit. Enter 14 environmental parameters β€” including location, meteorology, and WHO air-quality metrics β€” to instantly predict rainfall, temperature, and weather categories. Download a personalized, styled PDF report with every prediction.


πŸš€ Live Demo

Try the app now: https://forecastiq-weather-prediction-tool-2025.streamlit.app/

Get instant weather predictions by entering 14 environmental parameters including location, meteorology, and WHO air-quality metrics. Download your personalized weather report as a PDF!

forecaste.project.mp4

✨ Key Highlights

  • 🌧️ Rain Occurrence Classifier β€” 92.99% accuracy (ExtraTrees) for predicting rainfall events
  • 🌑️ Temperature Classifier β€” 97.72% accuracy (XGBoost) for temperature category prediction
  • πŸ“Š 14-Parameter Input System β€” Geography, meteorology & all 6 WHO air-quality indicators
  • πŸ“„ PDF Report Generation β€” Download a beautifully styled personalized weather report
  • πŸ”¬ 5-Algorithm Comparison β€” Extra Trees, Random Forest, XGBoost, LightGBM, SVM benchmarked
  • 🌍 WHO Air Quality Integration β€” CO, Ozone, NO2, SO2, PM2.5, PM10 as prediction features
  • πŸ““ End-to-End Notebook β€” Full training pipeline with evaluation charts and model export
  • ⚑ Streamlit UI β€” Interactive, responsive web interface with instant predictions
  • πŸ“ Dual Output Format β€” HTML report with PDF download (WeasyPrint / ReportLab fallback)
  • πŸ”’ Reproducible Pipeline β€” Joblib-serialized models for consistent, version-safe inference

πŸ“‹ Table of Contents


🌐 Overview

ForecastIQ predicts temperature and rainfall based on environmental and air-quality variables, studying how WHO air-quality parameters relate to climate outcomes. The repository contains:

  • A Streamlit UI (app.py) to make predictions with pre-trained models and download a styled HTML/PDF report.
  • A Jupyter notebook (final1.ipynb) that loads the dataset, explores features, trains multiple algorithms (Extra Trees, RandomForest, XGBoost, LightGBM, SVM), evaluates results, and saves the best models with Joblib.

πŸ”§ Features

🌦️ Core Prediction Features

  • Rainfall Amount Regression β€” Predicts precise rainfall in mm using log-transform pipeline
  • Temperature Regression β€” Continuous temperature prediction in Celsius
  • Rain Occurrence Classification β€” Binary prediction: Rain / No Rain
  • Temperature Category Classification β€” Multi-class: Cold / Moderate / Hot
  • 14-Feature Input Interface β€” All geographic, meteorological, and air-quality parameters

🌍 WHO Air Quality Integration

  • Carbon Monoxide (CO) β€” Air quality feature for climate correlation
  • Ozone (O3) β€” Atmospheric ozone as a weather predictor
  • Nitrogen Dioxide (NO2) β€” Pollution-weather relationship modeling
  • Sulphur Dioxide (SO2) β€” Industrial emission impact on weather
  • PM2.5 & PM10 β€” Particulate matter as environmental indicators
  • Cross-domain Analysis β€” Studies how air quality drives climate outcomes

πŸ“Š ML Pipeline Features

  • Multi-Algorithm Benchmarking β€” 5 algorithms evaluated side-by-side
  • Log Transform Preprocessing β€” log1p de-skewing for rainfall regression
  • KBinsDiscretizer Binning β€” Quantile-based temperature categorization
  • Confusion Matrix Visualization β€” Per-class evaluation charts in notebook
  • MSE & Accuracy Reporting β€” Regression and classification metrics
  • Joblib Model Serialization β€” Portable .pkl models for deployment

πŸ“„ Report & Export Features

  • Styled HTML Report β€” Full-page personalized prediction summary
  • PDF Download β€” WeasyPrint (primary) or ReportLab (fallback) generation
  • HTML Fallback Download β€” Always-available report export option
  • Decorative Report Footer β€” Optional character.png branding in PDF

πŸ–₯️ UI/UX Features

  • Responsive Streamlit Design β€” Works on desktop and tablet browsers
  • Instant Prediction Feedback β€” Real-time results on form submission
  • Input Validation β€” All 14 fields required with non-zero enforcement
  • Clean Numeric Input Interface β€” Organized by feature category
  • Browser Compatibility β€” Chrome, Firefox, Opera, Brave support

βš™οΈ Development & Production Features

  • Cross-platform Compatibility β€” Windows 11, macOS, Linux
  • Virtual Environment Support β€” Isolated dependency management
  • Notebook-to-App Workflow β€” Train in notebook, deploy via Streamlit
  • SDLC Best Practices β€” Structured development and evaluation pipeline
  • Scalable Architecture β€” Extendable with new features and datasets

πŸ“ Project Structure

ForecastIQ/
β”œβ”€β”€ app.py                      # Streamlit application (inputs, predictions, report/PDF)
β”œβ”€β”€ final1.ipynb                # End-to-end training & evaluation notebook
β”œβ”€β”€ requirements.txt            # Dependency list
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ __pycache__/                # Bytecode (ignored by git)
β”‚
β”œβ”€β”€ et_reg_rain.pkl             # ExtraTrees regression model (log rainfall)      [generated]
β”œβ”€β”€ et_reg_temp.pkl             # ExtraTrees regression model (temperature)       [generated]
β”œβ”€β”€ et_cls_rain.pkl             # ExtraTrees classifier (rain occurrence)         [generated]
└── et_cls_temp.pkl             # ExtraTrees classifier (temperature category)    [generated]

πŸ“ Data & Input Features

Notebook dataset: IndianWeatherRepository.xlsx

  • Read via pandas.read_excel β€” requires openpyxl

Targets created in the notebook:

Target Type Description
log_precip_mm Regression log1p(precip_mm) β€” de-skewed rainfall
rain_occurred Classification (precip_mm > 0).astype(int) β€” binary
Temperature bins Classification KBinsDiscretizer(n_bins=3, strategy='quantile')

App input features (14 numeric fields β€” all required):

Category Features
Geography latitude, longitude
Meteorology humidity, wind_kph, cloud, pressure_mb, uv_index, feels_like_celsius
WHO Air Quality air_quality_Carbon_Monoxide, air_quality_Ozone, air_quality_Nitrogen_dioxide, air_quality_Sulphur_dioxide, air_quality_PM2.5, air_quality_PM10

πŸ€– Models & Tasks

The workflow supports four prediction tasks:

# Task Type Target
1 Rainfall Amount Regression log_precip_mm converted back via expm1
2 Temperature Value Regression temperature_celsius
3 Rain Occurrence Binary Classification No Rain / Rain
4 Temperature Category Multi-class Classification Cold / Moderate / Hot

Algorithms evaluated:

  • ⭐ Extra Trees β€” Final .pkl models deployed in the app
  • 🌲 Random Forest
  • πŸš€ XGBoost
  • πŸ’‘ LightGBM
  • πŸ”΅ SVM (SVR for regression / SVC for classification)

πŸ“ˆ Model Accuracy Results

Rain Occurrence Classification

Model Accuracy
⭐ ExtraTrees 92.99%
LightGBM 92.38%
XGBoost 92.08%
Random Forest 91.85%
SVM 87.28%

Temperature Category Classification

Model Accuracy
⭐ XGBoost 97.72%
LightGBM 97.64%
Random Forest 97.03%
ExtraTrees 96.19%
SVM 92.61%

πŸ› οΈ Technologies Used

Backend & ML

Technology Purpose
Python 3.10+ Core language
scikit-learn Extra Trees, Random Forest, SVM, preprocessing
XGBoost Gradient boosting classifier & regressor
LightGBM Fast gradient boosting
Joblib Model serialization (.pkl export/load)
NumPy / Pandas Data manipulation and feature engineering
openpyxl Excel dataset reading

Frontend & Reporting

Technology Purpose
Streamlit Interactive web UI
WeasyPrint Primary PDF generation
ReportLab PDF fallback generator
Matplotlib / Seaborn Evaluation charts in notebook
Pillow Image handling for PDF report

βš™οΈ Installation (Windows / PowerShell)

1. Clone the repository

git clone https://github.com/varshinijayaprabhu/ForecastIQ-Weather-Prediction-Tool.git
cd "ForecastIQ  Weather Prediction Tool"

2. Create and activate a virtual environment

python -m venv .venv
.\.venv\Scripts\Activate.ps1

3. Install dependencies

pip install -r requirements.txt

4. PDF support (choose one)

  • WeasyPrint β€” already in requirements.txt; ensure Cairo & Pango native libs are installed on Windows
  • pdfkit + wkhtmltopdf β€” download the binary from wkhtmltopdf.org and ensure it is in PATH

▢️ Run the App

streamlit run app.py

In the UI:

  1. Enter all 14 feature values (non-zero required)
  2. Click Predict to see rainfall (mm), temperature (Β°C), rain occurrence, and temperature class
  3. Scroll to view the full HTML report
  4. Click Download PDF (or "Download HTML" as fallback)

Required model files in the repo root:

et_reg_rain.pkl    et_reg_temp.pkl    et_cls_rain.pkl    et_cls_temp.pkl

πŸ““ Train & Export Models (Notebook)

Open final1.ipynb and run cells in order:

  1. Load data β€” Read IndianWeatherRepository.xlsx, inspect, and clean
  2. Create targets β€” log_precip_mm, rain_occurred, temperature bins
  3. Split & train β€” ExtraTrees, RF, XGBoost, LightGBM, SVM
  4. Evaluate β€” MSE for regression; accuracy & confusion matrices for classification
  5. Export models:
import joblib
joblib.dump(et_reg_rain,  "et_reg_rain.pkl")
joblib.dump(et_reg_temp,  "et_reg_temp.pkl")
joblib.dump(et_cls_rain,  "et_cls_rain.pkl")
joblib.dump(et_cls_temp,  "et_cls_temp.pkl")

πŸ“¬ Contact

Designed and developed by Varshini J

GitHub LinkedIn Live Demo


⭐ If you found this project useful, consider giving it a star on GitHub!

About

the aim of this project is to develop a machine learning model to predict temperature and rainfall based on environmental features, with a specific focus on six air quality parameters identified by the World Health Organization (WHO).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors