# 🔥 Algerian Forest Fire — FWI Predictor (Flask App)
End-to-end deployment of the Ridge Regression model trained on the Algerian Forest Fires dataset.
## Project Structure
```
flask_regression_app/
├── app.py # Flask application (routes + API)
├── requirements.txt
├── models/
│ ├── ridge.pkl # Trained Ridge Regression model
│ ├── scaler.pkl # Fitted StandardScaler
│ └── dataset.csv # Original dataset (for EDA charts)
└── templates/
└── index.html # Full interactive frontend
```
## Setup & Run
```bash
# 1. Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the app
python app.py
```
Open
localhost in your browser.
## Features
| Section | Description |
|---------|-------------|
| **Predict** | Enter 9 weather/FWI inputs, get FWI prediction + risk label |
| **EDA** | 4 interactive charts: histogram, monthly trend, scatter, class dist |
| **Model** | Ridge coefficients, feature importances, model metadata |
## Input Features
| Feature | Description | Range |
|---------|-------------|-------|
| Temperature | Max temperature at noon (°C) | 22–42 |
| RH | Relative Humidity (%) | 21–90 |
| Ws | Wind Speed (km/h) | 6–29 |
| Rain | Total rain (mm) | 0–16.8 |
| FFMC | Fine Fuel Moisture Code | 28.6–92.5 |
| DMC | Duff Moisture Code | 1.1–65.9 |
| ISI | Initial Spread Index | 0–18.5 |
| Classes | Fire or Not Fire | 0 / 1 |
| Region | Bejaia or Sidi-Bel Abbes | 0 / 1 |
## API Endpoints
```
GET / → Main UI
POST /predict → JSON prediction { fwi, risk_label, risk_color }
GET /api/eda → EDA chart data
GET /api/model_info → Coefficients + model metadata
```
## FWI Risk Scale
| FWI Range | Risk Level |
|-----------|------------|
| 0–5 | Very Low |
| 5–10 | Low |
| 10–17 | Moderate |
| 17–24 | Hig …