Instructions to use adityasuyal/haldwani-Rainfall-Nowcast-Forecast with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use adityasuyal/haldwani-Rainfall-Nowcast-Forecast with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("adityasuyal/haldwani-Rainfall-Nowcast-Forecast", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
π§οΈ Haldwani Rainfall Nowcast & Forecast
A 5-model weighted ensemble for hourly rain prediction over Haldwani, Uttarakhand, India.
Built on open meteorological data from Open-Meteo, the system fuses Random Forest, Extra Trees, XGBoost, CatBoost, and LightGBM into a calibrated, uncertainty-aware forecast.
ποΈ Repository Contents
βββ models/
β βββ random_forest.pkl # Scikit-learn RandomForestClassifier
β βββ extra_trees.pkl # Scikit-learn ExtraTreesClassifier
β βββ xgboost.pkl # XGBoost XGBClassifier
β βββ catboost.pkl # CatBoost CatBoostClassifier
β βββ lightgbm.pkl # LightGBM LGBMClassifier
β βββ weighted_ensemble.pkl # Full weighted fusion model
β βββ feature_columns.pkl # Ordered list of input features
β βββ threshold.pkl # Classification threshold (v1)
β βββ production_config.pkl # Per-model weights + threshold
β βββ final_model_v2.pkl # v2 single-model checkpoint
β βββ final_features_v2.pkl # v2 feature columns
β βββ final_threshold_v2.pkl # v2 classification threshold
βββ app.py # Streamlit forecast dashboard
βββ predictor.py # RainPredictor inference class
βββ feature_engineering.py # Feature construction pipeline
βββ weather_api.py # Open-Meteo API wrapper
βββ config.py # Path configuration
βββ requirements.txt # Python dependencies
βββ plots/ # Diagnostic & analysis plots
π§ Models
| Model | Type | Library |
|---|---|---|
| Random Forest | Bagging ensemble | scikit-learn |
| Extra Trees | Bagging ensemble | scikit-learn |
| XGBoost | Gradient boosting | xgboost |
| CatBoost | Gradient boosting | catboost |
| LightGBM | Gradient boosting | lightgbm |
All five models are combined into a weighted ensemble via production_config.pkl, which stores each model's weight and the optimal classification threshold.
Uncertainty Estimation
The ensemble computes the unweighted standard deviation across all 5 model probabilities per forecast step. High std = models disagree = high uncertainty. This is used in the app to blend AI probability with Open-Meteo's POP (Probability of Precipitation) signal.
βοΈ Inference
Load & predict
import joblib
import pandas as pd
from predictor import RainPredictor
from weather_api import get_forecast_by_city, get_recent_observed
# Load the predictor (loads all models + config internally)
predictor = RainPredictor()
# Fetch live data from Open-Meteo
history_df = get_recent_observed("Haldwani")
forecast_df = get_forecast_by_city("Haldwani")
# Run inference
results = predictor.predict(history_df, forecast_df)
print(results[["time", "rain_probability", "prediction_label"]].head(24))
Output columns
| Column | Description |
|---|---|
rain_probability |
Weighted ensemble probability (0β100) |
prediction |
Binary prediction: 1 = Rain, 0 = No Rain |
prediction_label |
"Rain" / "No Rain" |
prob_random_forest |
Per-model probability (0β100) |
prob_extra_trees |
Per-model probability (0β100) |
prob_xgboost |
Per-model probability (0β100) |
prob_catboost |
Per-model probability (0β100) |
ensemble_std |
Model disagreement / uncertainty (0β100) |
π Run the Streamlit App
pip install -r requirements.txt
streamlit run app.py
The dashboard shows:
- Hourly rain forecast for the next 24 h
- Per-model probability breakdown
- Uncertainty-aware fusion with Open-Meteo POP
- Historical model diagnostics
π¦ Dependencies
streamlit==1.47.1
pandas==2.3.1
numpy==2.3.2
scikit-learn
joblib==1.5.1
requests==2.32.4
plotly==6.2.0
python-dateutil==2.9.0.post0
xgboost
catboost
lightgbm
π Location
Haldwani, Uttarakhand, India
Lat: 29.2183Β° N, Lon: 79.5130Β° E
Timezone: Asia/Kolkata (IST, UTC+5:30)
Weather data sourced from Open-Meteo β free, no API key required.
π Diagnostics
Model evaluation plots are included under plots/:
- Per-model diagnostic charts (confusion matrix, ROC, calibration)
- Weighted ensemble vs fusion comparison
- Feature importance comparison across models
- Rolling accuracy, temporal F1, and weight sensitivity analysis
π€ Author
Aditya Suyal
huggingface.co/adityasuyal
π License
MIT
- Downloads last month
- -