How laxmigs24/forest-fire-risk-project works
1. Repository purpose
This is a local, end-to-end wildfire severity prediction system. It combines offline data preparation and model training with a small interactive decision-support app for inference.
2. Primary subsystems
The repo has four main parts:
- data/: raw dataset source
- notebooks/: cleaning, EDA, and model development
- database/: local SQLite storage
- app/: Streamlit-based prediction interface
3. Data layer
The core dataset is the UCI Forest Fires dataset, stored in data/forestfires.names and analyzed from within notebooks. The data contains meteorological, environmental, and fire-spread variables used to predict wildfire severity risk.
4. Offline analytics and training workflow
The notebooks form the offline ML pipeline:
- 1_data_cleaning.ipynb prepares and transforms the dataset
- 2_eda.ipynb explores risk patterns and feature relationships
- 3_modeling.ipynb trains and evaluates classification models
This is the main development path before deployment.
5. Feature engineering boundary
The project explicitly transforms raw environmental inputs into model-ready features, including cyclical month/day encoding and wind log transformation. This feature engineering sits between raw data handling and model training.
6. Modeling subsystem
Multiple classifiers were explored, but the final operational model is a threshold-tuned XGBoost classifier. The architectural emphasis is not just prediction accuracy, but improved recall for severe wildfire events.
7. Decision threshold logic
A key design choice is threshold tuning away from the default 0.5 cutoff. This makes the system more sensitive to dangerous conditions and reduces false negatives, which is critical for operational wildfire risk assessment.
8. Persistence and local storage
The repository includes database/forestfireanalysis.db for structured local data storage and analysis workflows. The README also references a persisted model artifact (best_model.pkl), indicating model serialization for reuse by the app.
9. Deployment layer
app/streamlit_app.py is the runtime interface. It likely loads the trained model artifact, accepts environmental inputs, and returns a severity prediction, probability, and risk label. This is the only user-facing component in the repo.
10. User-facing workflow
The app acts as a thin inference layer over the trained model. Users provide environmental conditions such as temperature, humidity, wind, drought indicators, and spread metrics; the system responds with wildfire risk assessment and alerts.
11. Technology boundaries
The stack is all local and Python-based:
- pandas/NumPy for data handling
- scikit-learn and XGBoost for modeling
- SQLite for persistence
- Streamlit for UI
- Joblib for model storage
There is no evidence of a separate web backend or cloud service.
12. How the pieces connect
The architecture flows from dataset ingestion to notebook-based preprocessing/training, then into persisted artifacts in local storage, and finally into the Streamlit app for interactive inference. In diagram terms, the main boundary is between offline model development and online prediction.
Main entry points: 3_modeling.ipynb Modeling · 1_data_cleaning.ipynb Cleaning · streamlit_app.py Risk App · 2_eda.ipynb EDA
Components 16
Data
Raw dataset and source metadata.
- Forest Fires · UCI Forest Fires dataset metadata and raw data basis.
data/forestfires.names - Field Inputs · Temperature, humidity, wind, drought, and fire-spread variables.
Offline ML
Notebook-driven preparation, analysis, and training.
- Cleaning · Transforms and prepares the raw dataset for analysis.
notebooks/1_data_cleaning.ipynb - Features · Creates model-ready inputs such as cyclical month/day encoding and wind log transforms.
- EDA · Explores risk patterns and feature relationships.
notebooks/2_eda.ipynb - Modeling · Trains and evaluates classification models for wildfire severity.
notebooks/3_modeling.ipynb - XGBoost · Final operational model chosen for prediction performance and recall on severe events.
- Threshold · Tuneable cutoff that shifts predictions away from the default 0.5 to reduce false negatives.
- Recall Focus · Emphasizes sensitivity to dangerous wildfire conditions over raw accuracy.
Local Storage
Persistent artifacts used across analysis and inference.
- Best Model · Persisted trained model reused by the app.
- SQLite DB · Structured local storage for analysis workflows and persisted data.
database/forestfireanalysis.db
Inference App
Streamlit decision-support interface for wildfire risk prediction.
- Risk App · Interactive inference interface for wildfire severity prediction.
app/streamlit_app.py - User Inputs · Environmental conditions entered by a user in the app.
- Inference · Loads the model artifact, prepares inputs, and generates predictions.
- Risk Result · Returns severity prediction, probability, and risk label.
- Alerts · Operational guidance for dangerous wildfire conditions.
Connections 18
- Forest Fires → Cleaning: source data · Raw dataset feeds notebook-based preparation.
- Field Inputs → Cleaning: prepare · Environmental variables are cleaned and normalized.
- Cleaning → Features: transform · Prepared data is converted into model-ready features.
- Features → EDA: analyze · Engineered variables are inspected for patterns and relationships.
- Features → Modeling: train set · Feature set is used for model development.
- EDA → Modeling: insights · Exploratory findings inform modeling choices.
- Modeling → XGBoost: select · Best-performing classifier becomes the final model.
- XGBoost → Threshold: tune · Decision cutoff is adjusted for higher recall on severe events.
- Threshold → Recall Focus: optimize for · Threshold choice is driven by recall and false-negative reduction.
- XGBoost → Best Model: serialize · Trained model is saved for reuse.
- Modeling → SQLite DB: store results · Analysis artifacts and structured data support local workflows.
- Best Model → Inference: load model · App runtime loads the persisted classifier.
- SQLite DB → Inference: local data · Local persistence can support app-side analysis or lookup.
- Risk App → User Inputs: collect · UI accepts user-supplied environmental conditions.
- User Inputs → Inference: predict · Inputs are prepared and passed to the model.
- Inference → Risk Result: return · Pipeline produces probability and severity label.
- Risk Result → Alerts: inform · Prediction is translated into operational wildfire guidance.
- Risk App → Inference: orchestrate · UI coordinates the end-to-end prediction flow.