Forest Fire Weather Index (FWI) Prediction App: A Flask web app that predicts FWI for Algerian forests using weather data. Built with a Ridge Regression model trained on the Algerian Forest Fires Dataset (2012). Enter weather details to estimate fire risk instantly.
# Forest Fire Weather Index (FWI) Prediction Web App
A Flask web application that predicts the Forest Fire Weather Index (FWI) for Algerian forests using weather and environmental data. The app is powered by a Ridge Regression model trained on the Algerian Forest Fires Dataset (2012). Users can input weather details to estimate fire risk instantly.
WebApp Link
---
## 📊 Dataset
- **Source:** Algerian Forest Fires Dataset (2012)
- **Records:** 244 instances (122 each from Bejaia and Sidi-Bel Abbes regions)
- **Features:** Weather observations (Temperature, RH, Wind Speed, Rain, etc.), FWI components, Region, and Fire occurrence (Classes)
- **Target:** Fire Weather Index (FWI)
---
## 🚀 Project Workflow
1. **Data Cleaning & Preprocessing**
- Removed missing values and fixed column names.
- Encoded categorical variables (e.g., Classes: 0 = Not Fire, 1 = Fire).
- Added region codes (0 = Bejaia, 1 = Sidi-Bel Abbes).
2. **Feature Engineering**
- Dropped unnecessary columns (day, month, year).
- Checked and removed highly correlated features to reduce multicollinearity.
- Standardized features using `StandardScaler`.
3. **Model Training & Evaluation**
- Trained and compared several regression models:
- Linear Regression
- Lasso Regression (with/without cross-validation)
- Ridge Regression (with/without cross-validation)
- ElasticNet Regression (with/without cross-validation)
- Evaluated using Mean Absolute Error (MAE) and R² Score.
4. **Model Selection**
- Ridge Regression and ElasticNet performed best and were saved for deployment.
5. **Web App Deployment**
- Built a Flask web app for real-time FWI prediction.
---
## 📈 Model Comparison
| Model | MAE | R² Score |
|-----------------|----------|-----------|
| Linear Regression | 0.5468 | 0.9848 |
| Lasso | 1.1332 | 0.9492 |
| LassoCV | 0.6200 | 0.9821 |
| Ridge | 0.5642 | 0.9843 |
| RidgeCV | 0.5642 | 0.9843 |
| ElasticNet …