Skip to content

harshil-1402/Insurance-prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Insurance-prediction

Insurance Cost Prediction using Machine Learning

Introduction

This repository contains the code and data for a machine learning project that predicts insurance costs based on various factors. We have used three different regression models: Linear Regression, Support Vector Regression, and Random Forest Regression to predict insurance costs. We then evaluate the performance of each model using the R^2 score to determine which model has the best accuracy.

Dataset

The dataset used for this project is available in the insurance.csv file. It contains the following columns:

  • age: Age of the insured person.
  • sex: Gender of the insured person (male or female).
  • bmi: Body mass index (BMI) of the insured person.
  • children: Number of children/dependents covered by the insurance.
  • smoker: Whether the insured person is a smoker (yes or no).
  • region: The region where the insured person resides.
  • charges: The insurance cost charged to the insured person (target variable).

Models Used

  1. Linear Regression: Linear regression is a simple regression model that assumes a linear relationship between the input features and the target variable.

  2. Support Vector Regression (SVR): SVR is a regression technique that uses support vector machines to find the best-fitting line while minimizing the error.

  3. Random Forest Regression: Random Forest is an ensemble learning method that combines multiple decision trees to make predictions.

Installation

To run the code in this repository, you'll need the following libraries:

pip install numpy pandas scikit-learn

Usage

  1. Clone this repository:
git clone [https://github.com/yourusername/insurance-cost-prediction.git
cd insurance-cost-prediction](https://github.com/harshil-1402/Insurance-prediction)
  1. Run the Jupyter Notebook or Python script to train and evaluate the models.
jupyter notebook insurance_cost_prediction.ipynb
# OR
python insurance_cost_prediction.py
  1. Examine the results and the R^2 scores to determine the best model for insurance cost prediction.

Results

After running the models, the R^2 scores will be displayed, allowing you to compare their performance. The model with the highest R^2 score is the one that best predicts insurance costs.

Conclusion

This project demonstrates the application of machine learning regression models to predict insurance costs. By comparing the R^2 scores of the Linear Regression, Support Vector Regression, and Random Forest Regression models, we can determine which model provides the most accurate predictions for insurance costs.

Feel free to explore the code and dataset further, and customize it for your own insurance cost prediction tasks.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors