How wongtaiming/medical_insurance_cost_prediction_ml works
This repository is a Streamlit medical-insurance cost predictor. A user selects a model and enters personal, health, and lifestyle details; the app prepares model features, optionally scales them, loads a trained model, and presents an annual-cost estimate with explanations. The tree also documents preprocessing and training notebooks for three model families. The README provides no architectural detail, and the source excerpts are partial, so training-data flow and some runtime wiring are not shown.
Main entry points: Main.py Calculator interface · 01_Preprocessing.ipynb Preprocessing notebook · 04_SVRRBF.ipynb SVR training · medical_insurance.csv Insurance dataset
Components 20
Prediction app
- Calculator interface
Main.py - Feature preparation
Main.py - Model loading
Main.py - SVR scaling
Main.py - Cost prediction
Main.py - Annual cost estimate
Main.py
Estimate insights
- Estimate explanation
Main.py - Benchmark statistics
Main.py
Model training
- Preprocessing notebook
ml_training/01_Preprocessing.ipynb - Random forest training
ml_training/02_random_forest_model.ipynb - Linear regression training
ml_training/03_MultipleLinearRegression.ipynb - SVR training
ml_training/04_SVRRBF.ipynb
Data and artifacts
- Insurance dataset
dataset/medical_insurance.csv - Encoded dataset
dataset/medical_insurance_encoded.csv - Preprocessor artifact
models/preprocessor.pkl - Random forest model
models/random_forest_model.pkl - Linear regression model
models/MLR_model.pkl - SVR model
models/svr_rbf_model.pkl - SVR scaler
models/svr_scaler.pkl
Other components
- Insurance estimator user
Connections 21
- Insurance estimator user → Calculator interface: enters details
- Calculator interface → Feature preparation: prepares inputs
- Calculator interface → Model loading: loads selected model
- Model loading → Random forest model: loads
- Model loading → Linear regression model: loads
- Model loading → SVR model: loads
- Calculator interface → SVR scaling: scales SVR inputs
- SVR scaling → SVR scaler: loads scaler
- Calculator interface → Cost prediction: requests estimate
- Feature preparation → Cost prediction: provides features
- Cost prediction → Annual cost estimate: returns estimate
- Calculator interface → Estimate explanation: builds explanation
- Annual cost estimate → Estimate explanation: provides estimate
- Benchmark statistics → Insurance dataset: reads statistics
- Preprocessing notebook → Insurance dataset: prepares data
- Preprocessing notebook → Encoded dataset: produces encoded data
- Preprocessing notebook → Preprocessor artifact: saves artifact
- Random forest training → Random forest model: trains model
- Linear regression training → Linear regression model: trains model
- SVR training → SVR model: trains model
- SVR training → SVR scaler: saves scaler