Skip to content

KhanNosheen/Medical_Insurance_Cost_Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medical Insurance Cost Prediction

Predicted vs Actual Log Charges

Regression Model Performance

Linear Regression model performance visualizing predicted vs. actual values on a log scale.


Project Overview

This project predicts individual medical insurance costs using demographic and health data. To improve model accuracy and handle the right-skewed distribution of insurance charges, a Log Transformation was applied to the target variable (charges).

Key Objectives:

  • Analyze the impact of features like age, bmi, and smoker on total charges.
  • Train a Linear Regression model using Scikit-Learn.
  • Evaluate the model using standard regression metrics.

Model Performance

Based on the final evaluation, the model achieved the following results:

  • R² Score: 0.894
  • Mean Absolute Error (MAE): 0.21
  • Mean Squared Error (MSE): 0.098

Project Workflow

  1. Data Cleaning: Handled duplicates and verified no missing values existed.
  2. Feature Engineering: * Encoded categorical variables (sex, smoker, region).
    • Applied np.log() to the charges column to normalize the distribution.
  3. Training: Split the data into training and testing sets.
  4. Prediction: Generated predictions on the log-scale and visualized them against actual values.

Tech Stack

  • Language: Python
  • Libraries: Pandas, NumPy, Matplotlib, Seaborn, Scikit-Learn

File Structure

  • dataset/insurance.csv: Input dataset.
  • images/linear_trend.png: Visualization of results.
  • medical_insurance_cost_prediction.ipynb: Complete Python code and analysis.

Let's Connect!

Nosheen Khan on LinkedIn | Nosheen Khan on Kaggle

About

Predicting medical insurance costs using Python and OLS Regression. Includes log transformation and feature engineering.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors