This project explores and models risk and profitability in insurance data using statistical reasoning, EDA, version control with DVC, and machine learning techniques. It forms the foundation for a data-driven, risk-based premium pricing system.
To analyze insurance policy and claims data to:
- Understand customer risk and claim patterns (EDA)
- Quantify risk using loss ratio and other metrics
- Statistically validate segmentation hypotheses
- Predict claim severity, claim occurrence, and optimize premiums
- Enable transparency using explainable ML (SHAP)
Insurance-Risk-Analytics---Predictive-Modeling-for-ACIS/
├── data/ # Raw & processed datasets (DVC-managed)
│ ├── machineLearningRating_v3.txt
│ ├── cleaned_machineLearningRating.csv
│ ├── processed_for_modeling.csv
│ └── cleaned_machineLearningRating.csv.dvc
├── src/ # Modularized Python code
│ ├── data_load.py # Load & clean dataset
│ ├── eda.py # EDA functions & plots
│ └── __init__.py # Reusable helpers
├── notebooks/ # Jupyter notebooks
│ ├── import_clean.ipynb # Cleaning stage
│ ├── eda.ipynb # EDA & visual insights
│ ├── task3\_hypothesis.ipynb # A/B Hypothesis Testing
│ └── task4\_modeling.ipynb # Predictive Modeling
| ├── plots/ # Saved plots (grouped by type)
| │ ├── univariate/
| │ ├── bivariate/
| │ ├── multivariate/
| │ ├── time/
| │ ├── outliers/
| │ ├── geography/
| │ └── vehicle_risks/
| ├── saved_models/
| │ ├── randomforest_best_model.pkl
| │ ├── scaler.pkl
| │ ├── sgb_claim_occured_model.pkl
| │ ├── xgboost_severity_model.pkl
|
├── APP.PY
├── .gitignore
├── .dvcignore
├── README.md
├── LICENSE
└── requirements.txt
- Understand insurance risk patterns
- Assess data quality and completeness
- Explore geographic and demographic patterns
- Data Summarization: Descriptive statistics, data types, skewness
- Missing Value Assessment: Titles used to infer missing
GenderandMaritalStatus - Feature Engineering: Created
LossRatio = TotalClaims / TotalPremium - Univariate & Bivariate Analysis: Histograms, bar charts, segmented loss ratios
- Temporal Trends: 18-month premium/claim patterns
- Outlier Detection: Boxplots of financial metrics
- Top Risky Vehicles: Highest claim
makeandmodel - Loss Ratio by Zip Code: Geographic risk mapping
All visualizations are saved under plots/.
Enable reproducible data pipelines with version-controlled datasets.
dvc initinitialized in repo- Created a local remote:
~/dvc-storage - Tracked cleaned dataset:
dvc add data/cleaned_machineLearningRating.csv - Committed
.dvcfiles and.gitignoreupdates dvc pushsuccessfully pushed to local remote
This guarantees traceability, reproducibility, and collaboration readiness.
Goal: Statistically validate risk & margin segmentation hypotheses.
| Hypothesis # | Null Hypothesis | Result |
|---|---|---|
| H₀₁ | No risk difference across Provinces | Rejected |
| H₀₂ | No risk difference across Zip Codes | Rejected |
| H₀₃ | No margin difference across Zip Codes | Rejected |
| H₀₄ | No risk difference between Genders | Failed to Reject |
| Tracking Device | No risk difference due to Tracking Device | Failed to Reject |
| NewVehicle | No risk difference between New vs Old vehicles | Rejected |
- Tests Used: Chi-squared, ANOVA, Z-test (for proportions)
- KPIs: Claim Frequency, Claim Severity, Profit Margin
- Target:
TotalClaimsfor rows whereTotalClaims > 0 - Models: Linear Regression, Decision Tree, Random Forest, XGBoost
- Best Performance:
- XGBoost: RMSE = ~14,257, R² = ~0.87
- Target: Whether a claim occurred
- Metrics: Accuracy, Precision, Recall, F1-score, ROC AUC
- Best Model:
- XGBoost: ROC AUC = 0.901
- SHAP used to interpret XGBoost outputs for:
- Claim Severity Regression
- Claim Classification (Probability)
- Top Drivers Identified:
make,VehicleType,Province,SumInsured, etc.
- Provinces & Zip Codes show significant risk variation → segment pricing by geography
- Some vehicle types/models are disproportionately risky
- XGBoost consistently performs best, but business interpretability must be balanced
- SHAP explanations provide model transparency → crucial for insurance
- Tune models with cross-validation & hyperparameter optimization
- Integrate into Streamlit dashboard (Task 5 - Optional Bonus)
- Deploy risk-based pricing system to provide fair premiums
Install required packages:
pip install -r requirements.txt- Nurye Nigus
- Project: Insurance Risk Analytics & Modeling for ACIS






