Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏥 Medical Insurance Charges Predictor

Predict medical insurance charges based on user information such as age, sex, BMI, number of children, smoking status, and region.
Built using classical machine learning techniques and deployed via an interactive Streamlit dashboard.

📌 Description

This project applies supervised machine learning to predict individual medical insurance costs. The application leverages a cleaned dataset of personal health and demographic data and enables users to input custom values for real-time predictions. The results are visualized and interpreted through a user-friendly web dashboard.

💡 Motivation / Problem Solved

Insurance companies, actuaries, and healthcare professionals often need to estimate the expected cost of medical care for clients based on risk factors. Manual calculations are inefficient and fail to scale. This project:

  • Provides a data-driven, automated solution for charge prediction
  • Helps uncover feature importance and pricing patterns
  • Offers an interactive, explainable prediction tool to enhance transparency and decision-making

🚀 Features

  • 📊 Interactive Dashboard (Streamlit)
  • 🧮 User Input Form for real-time predictions
  • 📉 Model Comparison (Linear Regression, Ridge, Lasso, Random Forest, XGBoost)
  • 🔍 Feature Importance Visualization
  • 📈 Residual Analysis
  • 📥 Downloadable Results
  • 🧠 Model Insight & Documentation
  • 🗂️ Modular, clean project structure ready for production or extension

🛠️ Tech Stack

  • Python 3.10+
  • Pandas, NumPy – Data manipulation
  • Scikit-learn – ML models and preprocessing
  • XGBoost – Boosted trees model
  • Matplotlib, Seaborn – Data visualization
  • Streamlit – Web app interface
  • Jupyter Notebook – EDA & development
  • Git, GitHub – Version control

📦 Installation Instructions

# Clone the repo
git clone https://github.com/yourusername/insurance-price-predictor.git
cd insurance-price-predictor

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows

# Install dependencies
pip install -r requirements.txt

# Run the Streamlit dashboard
streamlit run app/dashboard.py

🧑‍💻 Usage Instructions

  1. Open the dashboard in your browser.
  2. Explore the dataset in the Data Exploration tab.
  3. Enter values in the User Prediction Form.
  4. View the predicted medical charges instantly.
  5. Analyze model performance and download sample results.

🧪 Example Output

Sample Prediction:

Input: 29 years old, male, BMI 27.3, smoker: no
Predicted Charges: $3,475.92

Feature Importance Plot:

Feature Importance

📁 Project Structure

insurance-price-predictor/ ├── app/ │ ├── dashboard.py │ └── components/ │ ├── header.py │ ├── data_exploration.py │ ├── feature_input.py │ ├── model_insights.py │ ├── download_section.py │ └── about.py ├── data/ │ └── insurance.csv ├── notebooks/ │ └── 01_exploration_and_modeling.ipynb ├── outputs/ │ ├── plots/ │ └── results.csv ├── src/ │ ├── data_preprocessing.py │ ├── train_models.py │ └── evaluate_models.py ├── main.py ├── requirements.txt └── README.md



## 🤝 Contributing Guidelines

Contributions are welcome!  
If you'd like to improve the project or add new models:

1. Fork the repo  
2. Create a new branch (`git checkout -b feature/model-name`)  
3. Commit your changes  
4. Push to your branch  
5. Open a pull request


## 📜 License

Licensed under the **MIT License**.  
See `LICENSE` file for more details.



## 👤 Author

**Stephen Kinuthia**  
📧 [kinuthiastephen94@gmail.com](mailto:kinuthiastephen94@gmail.com)  
🐙 [GitHub](https://github.com/stephenkinuthia-cell)


## ⭐ Show your support

If you found this useful or interesting, give it a ⭐ on GitHub!

About

Predict medical insurance charges using ML models like Linear Regression, Random Forest, and XGBoost. Includes data exploration, feature importance, and a Streamlit dashboard for real-time predictions.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages