Logo Lanfrica

dibyo10/AlgerianForestFire-ML-Logistic

Domaine:

environment and energy

Type de record:

project
Créateur:
dib
Hôte:
Algerian Forest Fires - L1 Logistic Regression This project uses the Algerian Forest Fires dataset to predict whether a forest fire occurred, based on meteorological and environmental data. The approach includes thorough data cleaning, advanced feature engineering (such as cyclical encoding for days and one-hot encoding for months), skewness corre # 🏞️ Algerian Forest Fires - L1 Logistic Regression --- ## 📘 Project Overview This project focuses on **classifying whether a forest fire occurred** using meteorological features. Leveraging the **Algerian Forest Fires dataset**, the goal is to build a high-performance **Logistic Regression model** with **L1 (Lasso) regularization** to accurately detect fire occurrence. - **Dataset Origin:** Algerian Forest Fires dataset - **Objective:** Predict fire occurrence (`Classes`) based on weather and environmental features. --- ## 🧠 Techniques Used - **Data Cleaning** - Removed missing values. - Dropped irrelevant columns. - Corrected datatype issues. - **Feature Engineering** - Cyclical encoding of `day` using sin/cos transformations: ```python df['day_sin'] = np.sin(2 * np.pi * df['day']/31) df['day_cos'] = np.cos(2 * np.pi * df['day']/31) ``` - One-hot encoding of `month`. - **Skewness Handling** - Applied `log1p` transformation for right-skewed features (e.g., Rain, ISI, DMC). - Used `power` (e.g., squaring) transformation for left-skewed features (e.g., FFMC). - **Feature Scaling** - Used `StandardScaler` **after** train-test split to prevent data leakage: ```python scaler = StandardScaler() X_train_scaled = scaler.fit_transform(X_train) X_test_scaled = scaler.transform(X_test) ``` - **Modeling** - Trained a Logistic Regression model with `penalty='l1'` and `solver='liblinear'`: ```python model = LogisticRegression(penalty='l1', solver='liblinear') model.fit(X_train_scaled, y_train) ``` - Handled class imbalance with stratified split. - **Evaluation** - Used `classification_report`, `confusion_matrix`, `accuracy_score`. - Achieved **~95.89% accuracy** on test data. - Nearly identical train/test metrics (no overfitting). --- ## 🧩 Challenges Faced & How I Solved Them - 🌪️ **Misunderstood left-skew vs right-skew:** Fixed after learning the correct transformation for each type. - 🤔 **Confusion about when to scale:** Clarified to **only apply scaling after t …