# Algerian Forest Fire FWI Prediction (End-to-End ML)
This project focuses on predicting the Fire Weather Index (FWI)—a critical component of the Canadian Forest Fire Weather Index System—using weather data from the Algerian Forest Fire dataset.
## Project Overview
Target Variable: FWI (Fire Weather Index).
Problem Type: Regression.
Goal: Build a model that accurately predicts the FWI based on temperature, humidity, wind speed, and rainfall.
## Data Preprocessing & Feature Engineering
Based on the project requirements:
Cleaning: Stripped hidden spaces and handled missing values in the dataset.
Feature Transformation: Converted the Classes column to binary (0 for not fire, 1 for fire) so it could be used as an input feature for the regression models.
Multicollinearity Analysis: Conducted correlation checks between features like Temperature, RH, and Wind Speed to ensure stable model coefficients.
## Model Evaluation
I implemented several regression models separately to find the best predictor for FWI; LinearRegressor, Ridge, Lasso, RidgeCV, LassoCV ...
Selection: The Ridge Regressor was chosen as the final model for deployment due to its superior performance in handling correlated weather features.
## Flask app — `application.py` 🔧
**Overview:** The Flask app serves a small web interface and prediction endpoint that uses the trained Ridge regression model and a fitted StandardScaler to predict the Fire Weather Index (FWI).
**What it does**
- Loads model and scaler: `models/ridge_model.pkl`, `models/scaler.pkl`.
- Routes:
- `/` — renders `index.html`.
- `/predictdata` — accepts `POST` requests from the HTML form, reads numeric inputs, scales them with the loaded `StandardScaler`, runs `ridge_model.predict(...)`, and renders `home.html` with the prediction.
- Expected form inputs (read as floats): `Temperature`, `RH`, `Ws` (wind speed), `Rain`, `FFMC`, `DMC`, `ISI`, `Classes`, `Region`. They are passed to the scaler in that order.
**Usage**
- Run …