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.
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
- π§οΈ 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
- Overview
- Features
- Project Structure
- Data & Input Features
- Models & Tasks
- Model Accuracy Results
- Technologies Used
- Installation
- Run the App
- Train & Export Models
- Troubleshooting
- Contact
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.
- 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
- 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
- Multi-Algorithm Benchmarking β 5 algorithms evaluated side-by-side
- Log Transform Preprocessing β
log1pde-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
.pklmodels for deployment
- 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.pngbranding in PDF
- 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
- 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
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]
Notebook dataset: IndianWeatherRepository.xlsx
- Read via
pandas.read_excelβ requiresopenpyxl
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 |
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
.pklmodels deployed in the app - π² Random Forest
- π XGBoost
- π‘ LightGBM
- π΅ SVM (SVR for regression / SVC for classification)
| Model | Accuracy |
|---|---|
| β ExtraTrees | 92.99% |
| LightGBM | 92.38% |
| XGBoost | 92.08% |
| Random Forest | 91.85% |
| SVM | 87.28% |
| Model | Accuracy |
|---|---|
| β XGBoost | 97.72% |
| LightGBM | 97.64% |
| Random Forest | 97.03% |
| ExtraTrees | 96.19% |
| SVM | 92.61% |
| 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 |
| 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 |
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.ps13. Install dependencies
pip install -r requirements.txt4. 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
streamlit run app.pyIn the UI:
- Enter all 14 feature values (non-zero required)
- Click Predict to see rainfall (mm), temperature (Β°C), rain occurrence, and temperature class
- Scroll to view the full HTML report
- 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
Open final1.ipynb and run cells in order:
- Load data β Read
IndianWeatherRepository.xlsx, inspect, and clean - Create targets β
log_precip_mm,rain_occurred, temperature bins - Split & train β ExtraTrees, RF, XGBoost, LightGBM, SVM
- Evaluate β MSE for regression; accuracy & confusion matrices for classification
- 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")