This project predicts medical insurance charges using a Linear Regression model. The complete machine learning pipeline was implemented, including data cleaning, exploratory data analysis (EDA), feature engineering, feature scaling, feature selection, model training, and evaluation.
insurance_model/
├── images/
│ ├── actual_vs_predicted_charges.png
│ ├── feature_importance.png
│ └── corr_heatmap.png
├── insurance.csv
├── insurance.ipynb
├── README.md
├── requirements.txt
The dataset contains demographic and health-related information about individuals, including:
- Age
- Gender
- BMI
- Number of Children
- Smoking Status
- Region
- Insurance Charges (Target)
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
- SciPy
- Checked missing values
- Removed duplicates
- Verified data types
- Distribution Analysis
- Correlation Analysis
- Boxplots
- Histograms
- Countplots
- One-Hot Encoding
- BMI Category Creation
- 80% Training Data
- 20% Testing Data
- StandardScaler
- Pearsonr Correlation
- Mutual Information Regression
- Linear Regression
The correlation heatmap visualizes the relationships between numerical features in the dataset. It helps identify positively and negatively correlated variables, providing insights into feature interactions before model training.
This scatter plot compares the actual insurance charges with the model's predicted values. The closer the data points are to the diagonal reference line, the better the model's predictive performance.
This chart displays the importance of each feature based on Mutual Information scores. Features with higher scores have a stronger relationship with the target variable and contribute more significantly to the prediction of insurance charges.
| Metric | Value |
|---|---|
| R² Score | 80.35% |
| Adjusted R² | 79.90% |
| Mean Squared Error (MSE) | 36,103,448.76 |
| Root Mean Squared Error (RMSE) | 6008.61 |
The Linear Regression model explains approximately 80% of the variance in insurance charges.
The small difference between the R² Score and Adjusted R² indicates that the selected features contribute effectively to the model without introducing unnecessary complexity.
Ayyan Ahmed


