A Streamlit web application for analyzing insurance data and comparing different machine learning models for predicting insurance charges.
- 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)
- Python 3.8+
- Streamlit
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
- Plotly Express
-
Clone this repository:
git clone https://github.com/adi99304/Insurance_prediction.git cd Insurance_prediction -
Create a virtual environment (optional but recommended):
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Run the Streamlit app:
streamlit run app.py
-
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
datafolder
-
Select plot types and variables to visualize your data
-
Choose a model type and train it on your data
-
Enter custom values to test predictions with your trained model
The app works with insurance datasets containing the following features:
age: Age of the insured personsex: Gender of the insured (male/female)bmi: Body Mass Indexchildren: Number of dependentssmoker: Smoking status (yes/no)region: Residential area (northeast/northwest/southeast/southwest)charges: Insurance premium charges
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.
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name - (https://github.com/adi99304)
- Streamlit for the amazing framework
- Scikit-learn for machine learning tools
- Plotly Express for interactive visualizations