Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 Insurance Data Analysis & Model Comparison

A Streamlit web application for analyzing insurance data and comparing different machine learning models for predicting insurance charges.

image image

🌟 Features

  • Data Upload: Easily upload your own CSV dataset for analysis
  • Data Visualization: Generate various plots to understand your data
    • Distribution plots
    • Scatter plots with optional color variables
    • Box plots for categorical analysis
    • Violin plots with data points
    • Correlation heatmaps for numeric features
  • Model Training: Compare different regression models
    • Linear Regression
    • Decision Tree
    • Random Forest
  • Model Evaluation: View performance metrics
    • Root Mean Squared Error (RMSE)
    • Mean Absolute Error (MAE)
    • R-squared (R²)
  • Custom Predictions: Test trained models with your own input values
    • Support for both numeric and categorical inputs
    • Includes demographic features (sex, smoker status, region)

📋 Requirements

  • Python 3.8+
  • Streamlit
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-learn
  • Plotly Express

🚀 Installation

  1. Clone this repository:

    git clone https://github.com/adi99304/Insurance_prediction.git
    cd Insurance_prediction
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    
    # On Windows
    venv\Scripts\activate
    
    # On macOS/Linux
    source venv/bin/activate
  3. Install the required packages:

    pip install -r requirements.txt
  4. Run the Streamlit app:

    streamlit run app.py

📝 Usage

  1. Upload your CSV file containing insurance data

    • Required columns: age, sex, bmi, children, smoker, region, charges
    • You can use the sample dataset provided in the data folder
  2. Select plot types and variables to visualize your data

  3. Choose a model type and train it on your data

  4. Enter custom values to test predictions with your trained model

📚 Example Dataset

The app works with insurance datasets containing the following features:

  • age: Age of the insured person
  • sex: Gender of the insured (male/female)
  • bmi: Body Mass Index
  • children: Number of dependents
  • smoker: Smoking status (yes/no)
  • region: Residential area (northeast/northwest/southeast/southwest)
  • charges: Insurance premium charges

🔄 Converting from R Shiny

This app was converted from an R Shiny dashboard to Python Streamlit. The conversion maintains the core functionality while leveraging Python's machine learning ecosystem.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

Your Name - (https://github.com/adi99304)

🙏 Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages