# Algerian Forest Fire — FWI Prediction
A web app that predicts the **Fire Weather Index (FWI)** from weather and fuel-moisture readings using a Ridge Regression model. Built with Flask and scikit-learn, with a custom front end.
The model is trained on the Algerian Forest Fires dataset from the UCI Machine Learning Repository, which covers the Bejaia and Sidi-Bel Abbes regions of Algeria between June and September 2012.
## Screenshots
**Landing page**
**Prediction page**
## How the app works
The user enters nine values (temperature, humidity, wind, rain, and four fire-behaviour indices). The app scales them with the same `StandardScaler` that was fitted during training, feeds them to the trained Ridge model, and returns the predicted FWI together with a danger band:
| FWI | Danger band |
|---|---|
| below 5 | Low |
| 5 – 15 | Moderate |
| 15 – 25 | High |
| 25 and above | Extreme |
## How the model works
The full pipeline lives in `notebooks/project.ipynb`. In summary:
1. **Cleaning** — the raw file stacks the two regions on top of each other, so a `Region` column is added (0 = Bejaia, 1 = Sidi-Bel Abbes), missing rows and a repeated header row are dropped, column names are trimmed, and every column is cast to its correct numeric type.
2. **Encoding** — the target class label is converted to a number (`not fire` = 0, `fire` = 1).
3. **Feature selection** — a correlation matrix is used to drop features that are more than 0.85 correlated with another feature. `BUI` and `DC` are removed because they carry almost the same information as `DMC` and the other indices (see the heatmap below), which leaves the nine features the app asks for.
4. **Scaling** — features are standardised with `StandardScaler` (mean 0, variance 1) so no single feature dominates.
5. **Training** — the data is split 75% train / 25% test, and five linear models are compared. Ridge Regression is chosen for deployment.
### Feature correlation
`FWI` is most strongly correlated with ` …