A Flask-based web application that predicts the Fire Weather Index (FWI) — an indicator of forest fire risk — using a Ridge Regression model trained on the Algerian Forest Fires dataset. The app allows users to input environmental conditions and get real-time fire risk predictions.
# 🌲 Algerian Forest Fire Prediction – End-to-End Machine Learning Project
This project predicts the **fire risk percentage** for the Algerian forest regions using environmental and meteorological data.
It’s a complete end-to-end pipeline — from **data preprocessing and model training** to a **Flask web application**.
---
## 🚀 Project Overview
The **Algerian Forest Fire Dataset** contains environmental attributes like temperature, humidity, and wind speed to help predict forest fire occurrences.
Using regression models, this project estimates the likelihood (in %) of a fire occurring based on the given inputs.
---
## 🧠 Machine Learning Pipeline
### 1️⃣ Data Collection
The dataset was obtained from the **UCI Machine Learning Repository**.
It includes meteorological data from two regions of Algeria — **Bejaia** and **Sidi Bel-Abbès**.
### 2️⃣ Data Preprocessing
- Handled missing values
- Cleaned and standardized data
- Encoded categorical features (`Region`, `Classes`)
- Applied feature scaling using `StandardScaler`
### 3️⃣ Exploratory Data Analysis (EDA)
- Visualized feature correlations
- Identified outliers and trends
- Checked multicollinearity between features
### 4️⃣ Feature Engineering
- Selected key predictors influencing fire risk:
**Temperature, RH, Ws, Rain, FFMC, DMC, ISI, Classes, Region**
- Performed feature scaling (standardization)
### 5️⃣ Model Training
The following models were trained and evaluated:
- 🔹 **Linear Regression**
- 🔹 **Lasso Regression**
- 🔹 **LassoCV**
- 🔹 **Ridge Regression**
- 🔹 **RidgeCV**
The **Ridge Regression model** gave the best performance and was saved as a `.pkl` file for deployment.
### 6️⃣ Model Serialization
Two pickle files were created:
- `ridge_model.pkl` → Trained Ridge Regression model
- `scaler.pkl` → StandardScaler object for input scaling
---
## 🌐 Flask Web Application
The Flask web app allows users to input environmental parameters and get the **predicted fire risk percentage** instantly.
### 🖼️ P …