Exploratory Data Analysis (EDA) and Machine Learning for AlphaCare Insurance Solutions
Data: MachineLearningRating_v3.csv (converted from pipe-separated .txt, Feb 2014–Aug 2015)
- Project Overview
- Folder Structure
- Setup & Installation
- Usage
- Key Features
- Data Notes
- Results & Outputs
- Contributing
- License
This project analyzes insurance policy and claims data to:
- Calculate and visualize loss ratios by province, vehicle type, and gender
- Explore distributions and outliers in premiums, claims, and vehicle values
- Identify temporal trends in claim frequency and severity
- Highlight vehicle makes/models associated with high or low claim amounts
- Build and evaluate predictive models for claim severity, claim probability, and premium optimization
- Implement a dynamic, risk-based pricing system using machine learning
- Interpret model results and provide actionable business insights for insurance pricing
insurance-risk-analytics/
│
├── data/ # Raw and processed data files
│ └── MachineLearningRating_v3.csv
├── notebooks/ # Jupyter notebooks for EDA and analysis
│ └── eda_analysis.ipynb
├── src/ # Source code (data loading, preprocessing, utils)
│ ├── data_loader.py
│ ├── data_preprocessor.py
│ └── utils.py
├── plots/ # Generated plots and visualizations
├── README.md
└── requirements.txt
-
Clone the repository:
git clone https://github.com/yourusername/insurance-risk-analytics.git cd insurance-risk-analytics -
Create and activate a virtual environment (optional but recommended):
python -m venv venv venv\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
- Run EDA notebook:
- Open
notebooks/eda_analysis.ipynbin Jupyter or VS Code. - Run all cells to generate summary statistics and plots.
- Open
=======
Exploratory Data Analysis (EDA) and Machine Learning for AlphaCare Insurance Solutions
Data: MachineLearningRating_v3.csv (converted from pipe-separated .txt, Feb 2014–Aug 2015)
- Project Overview
- Folder Structure
- Setup & Installation
- Usage
- Key Features
- Data Notes
- Results & Outputs
- Contributing
- License
This project analyzes insurance policy and claims data to:
- Calculate and visualize loss ratios by province, vehicle type, and gender
- Explore distributions and outliers in premiums, claims, and vehicle values
- Identify temporal trends in claim frequency and severity
- Highlight vehicle makes/models associated with high or low claim amounts
insurance-risk-analytics/
│
├── data/ # Raw and processed data files
│ └── MachineLearningRating_v3.csv
├── notebooks/ # Jupyter notebooks for EDA and analysis
│ └── eda_analysis.ipynb
├── src/ # Source code (data loading, preprocessing, utils)
│ ├── data_loader.py
│ ├── data_preprocessor.py
│ └── utils.py
├── plots/ # Generated plots and visualizations
├── README.md
└── requirements.txt
-
Convert raw TXT to CSV (if needed):
python src/data_loader.py
-
Preprocess data for modeling:
python src/data_preprocessor.py
-
Run Predictive Modeling notebook (Task 4):
- Open
notebooks/predictive_modeling.ipynb. - Run all cells to build, evaluate, and interpret predictive models for risk-based pricing.
- Review outputs for model performance, feature importance, and business recommendations.
- Open
- Data Cleaning: Handles missing values, mixed types, and converts columns to appropriate types.
- Descriptive Statistics: Summarizes key numerical and categorical features.
- Visualization: Generates histograms, bar charts, scatter plots, box plots, and heatmaps.
- Loss Ratio Analysis: Calculates and visualizes loss ratios by region and other factors.
- Temporal Analysis: Examines trends in claims over time.
- Vehicle Analysis: Identifies makes/models with highest and lowest claim amounts.
- Predictive Modeling: Machine learning models for claim severity (regression), claim probability (classification), and premium optimization (regression).
- Risk-Based Pricing Engine: Calculates premiums based on predicted claim probability and severity, with expense loading and profit margin.
- Model Evaluation: Comprehensive metrics (RMSE, R², accuracy, precision, recall, F1-score, confusion matrix) and cross-validation.
- Interpretability: SHAP analysis for feature importance and business interpretation.
- Business Insights: Actionable recommendations for pricing, risk segmentation, and model deployment.
CapitalOutstandinghad comma-separated numbers, converted to floats.MaritalStatus,Gender,CrossBorderhad mixed types, set as categories.- Negative
TotalPremiumandTotalClaimsmay indicate refunds or errors. CustomValueEstimatehas 78% missing values.- Some columns may have mixed types; see code for dtype handling.
- Plots: Saved in the
plots/directory (e.g.,total_claims_hist.png,loss_ratio_province.png). - Summary statistics: Printed in the EDA notebook output.
- Cleaned data: Saved as CSV after preprocessing.
- Predictive modeling results:
- Model performance metrics (RMSE, R², accuracy, F1, etc.)
- SHAP feature importance and business interpretation
- Risk-based premium calculations and comparisons
- Business insights and recommendations for insurance pricing
Pull requests and suggestions are welcome!
Please open an issue to discuss your ideas or report bugs.
-
Clone the repository:
git clone https://github.com/yourusername/insurance-risk-analytics.git cd insurance-risk-analytics -
Create and activate a virtual environment (optional but recommended):
python -m venv venv venv\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
-
Run EDA notebook:
- Open
notebooks/eda_analysis.ipynbin Jupyter or VS Code. - Run all cells to generate summary statistics and plots.
- Open
-
Convert raw TXT to CSV (if needed):
python src/data_loader.py
-
Preprocess data for modeling:
python src/data_preprocessor.py
- Data Cleaning: Handles missing values, mixed types, and converts columns to appropriate types.
- Descriptive Statistics: Summarizes key numerical and categorical features.
- Visualization: Generates histograms, bar charts, scatter plots, box plots, and heatmaps.
- Loss Ratio Analysis: Calculates and visualizes loss ratios by region and other factors.
- Temporal Analysis: Examines trends in claims over time.
- Vehicle Analysis: Identifies makes/models with highest and lowest claim amounts.
CapitalOutstandinghad comma-separated numbers, converted to floats.MaritalStatus,Gender,CrossBorderhad mixed types, set as categories.- Negative
TotalPremiumandTotalClaimsmay indicate refunds or errors. CustomValueEstimatehas 78% missing values.- Some columns may have mixed types; see code for dtype handling.
- Plots: Saved in the
plots/directory (e.g.,total_claims_hist.png,loss_ratio_province.png). - Summary statistics: Printed in the EDA notebook output.
- Cleaned data: Saved as CSV after preprocessing.
Pull requests and suggestions are welcome!
Please open an issue to discuss your ideas or report bugs.