# Algeria Fire prediction
In this project, I experimented with the step-by-step implementation of an ML project lifecycle. It involves data cleaning, exploratory data analysis (EDA), feature engineering, model training, and hyperparameter tuning. After completing the machine learning part, I developed a user interface using Flask and hosted the project on GitHub.
The machine learning models I worked with include Linear Regression, Ridge, Lasso, and ElasticNet. I fine-tuned these models using RidgeCV, LassoCV, and ElasticNetCV, and found that LassoCV gave the best performance.
## Table of Contents
- Installation
- Usage
- File Structure
- API Endpoints
- Logging
- Error Handling
## Installation
### Prerequisites
Ensure you have the following installed:
- Python 3.7+
- Flask
- Scikit-learn
- Pandas
- Numpy
### Setup
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Ensure the necessary model and preprocessor files are available in the correct directories:
- `Preprocessors/KNNImputer.pkl`
- `Preprocessors/outlier_bounds.json`
- `Preprocessors/RobustScalar.pkl`
- `Model/LassoCV.pkl`
3. Run the Flask application:
```bash
python application.py
```
## Usage
### API Endpoints
#### 1. `GET /`
Returns the HTML form where users can manually input meteorological data to get predictions.
#### 2. `POST /predict`
Accepts JSON data in the following format to return a prediction:
```json
{
"region": "0",
"Temperature": 29,
"RH": 57,
"Ws": 18,
"Rain": 0.0,
"FFMC": 65.7,
"DMC": 3.4,
"ISI": 1.3,
"Classes": 0
}
```
**Response**:
```json
{
"prediction": 0.69
}
```
### Example of a POST request using `curl`:
```bash
curl -X POST
127.0.0.1 \\
-H "Content-Type: application/json" \\
-d '{
"region": "0",
"Temperature": 39,
"RH": 57,
"Ws": 18,
"Rain": 0.0,
"FFMC": 65.7,
"DMC": 3.4,
"ISI": 1.3,
"Classes": 0
}'
```
## File Structure
```bash
.
├── application.py # Flask application
├── dependencies.py # Contains data t …