Skip to content

fix(health-insurance): resolve missing model and label encoders, add train pipeline - #1725

Merged
sanjay-kv merged 1 commit into
recodehive:mainfrom
bobby404-K:fix-health-insurance-price-prediction
Nov 14, 2026
Merged

sanjay-kv merged 1 commit into
recodehive:mainfrom
bobby404-K:fix-health-insurance-price-prediction

Conversation

@bobby404-K

Copy link
Copy Markdown
Member

Description

Fixes critical runtime crashes and reproducibility issues in the Health Insurance Price Prediction application (projects/prediction/Health Insurance Price prediction/):

  • Missing Model & Encoders: Created train.py with insurance.csv (1,338 samples) to train and export linear_regression_model.pkl (Test R�: 0.7833) and label_encoders.pkl.
  • Safe Path Resolution: Updated app.py to use os.path.join(os.path.dirname(__file__), ...) for linear_regression_model.pkl and label_encoders.pkl to eliminate FileNotFoundError.
  • Negative Charge Guard & Sensible Defaults: Bounded predictions with max(0.0, float(predicted_charge)) and configured sensible default inputs (age=25, bmi=25.0, children=0).
  • Flexible Dependencies: Updated requirements.txt to remove restrictive legacy pins for pandas, numpy, scikit-learn, joblib, and streamlit to ensure compatibility across modern Python versions (3.10-3.13).
  • Added insurance.csv: Included the standard 1,338-row dataset for complete pipeline reproducibility.

Fixes #1724

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@bobby404-K

Copy link
Copy Markdown
Member Author

@sanjay-kv Would you like to close this PR or merge? don't let it be open!

@sanjay-kv
sanjay-kv merged commit 546827a into recodehive:main Nov 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞[Bug]: Health Insurance Price Prediction app crashes due to missing linear_regression_model.pkl and label_encoders.pkl

2 participants