How rohan6162/medical-insurance-cost-prediction works
This repository is a medical-insurance charge estimation project: it explores and preprocesses a dataset, trains and compares regressors, analyzes feature importance, and serves estimates through Streamlit. The main user workflow is entering personal and lifestyle details in the app, which encodes them into the model’s feature columns and predicts charges with the saved Random Forest. Source excerpts support the analysis, training, artifact, and prediction links; README documents the broader workflow and reported comparison results.
Main entry points: insurance.csv Insurance dataset · random_forest_model.pkl Saved Random Forest · save_model.py Random Forest training · feature_importance.py Feature importance
Components 14
Data exploration
- Insurance dataset
data/insurance.csv - Dataset profiling
data_analysis.py - Feature encoding
preprocess.py - Exploratory plots
eda.py
Model development
- Regressor evaluation
train_models.py - Random Forest training
save_model.py - Saved Random Forest
models/random_forest_model.pkl - Feature order
models/feature_names.pkl
Model insights
- Feature importance
feature_importance.py - Importance results
models/feature_importance.csv - Comparison plots
model_comparison.py
Prediction app
- Streamlit prediction
app.py - Prediction helper
predict.py
Other components
- Insurance applicant
Connections 16
- Dataset profiling → Insurance dataset: reads
data_analysis.py - Feature encoding → Insurance dataset: reads
preprocess.py - Exploratory plots → Insurance dataset: plots
eda.py - Regressor evaluation → Insurance dataset: trains on
train_models.py - Random Forest training → Insurance dataset: trains on
save_model.py - Random Forest training → Saved Random Forest: saves model
save_model.py - Random Forest training → Feature order: saves columns
save_model.py - Feature importance → Insurance dataset: reads
feature_importance.py - Feature importance → Saved Random Forest: loads
feature_importance.py - Feature importance → Importance results: writes
feature_importance.py - Comparison plots → Insurance dataset: compares metrics
- Insurance applicant → Streamlit prediction: enters details
app.py - Streamlit prediction → Saved Random Forest: predicts with
app.py - Streamlit prediction → Feature order: orders columns
app.py - Prediction helper → Saved Random Forest: predicts with
predict.py - Prediction helper → Feature order: orders columns
predict.py