Projects

Predictive Model

Insurance Cost Predictor

A backend-wrapped Streamlit project that loads the original saved model artifacts and returns annual cost predictions with uncertainty and feature drivers.

Run demoGitHub placeholder

Inputs

6

age, BMI, children, sex, region, smoker

Best model R2

0.846

XGBoost comparison metric

Backend

FastAPI

wraps original shared.py

overview

The backend imports the original Insurance Cost Predictor Streamlit shared module and calls make_prediction directly. It reuses the saved subgroup Random Forest regressors, smoker classifier path, quantile regression interval, and model comparison metrics.

role

Portfolio integration: replaced the Streamlit UI with a Next.js dashboard while preserving the original inference path and model artifacts.

backend runner

Run original project workflow

Calls /api/insurance/predict on the FastAPI wrapper at http://localhost:8000.

original predictor inputs

Smoking status

Model selector

Block 2 stratified Random Forest

backend contract

Start the backend with uvicorn backend.main:app --reload --port 8000. The UI displays mode and provenance so recorded artifacts are clearly distinguished from live computation.

No backend result yet

Configure the inputs and run the backend to display the original project trace and outputs here.

architecture flow

Agent and model flow

The live pipeline trace appears in the backend runner after execution. This section shows the original project components that the backend wraps.

01

classifier

Block 2 Router

segment

Uses known smoker status directly, or estimates smoker probability for unknown status.

02

model

Subgroup Random Forests

annual USD

Loads the original smoker and non-smoker Random Forest regressor artifacts.

03

uncertainty

Quantile Regression

q10-q90

Uses the original q10/q50/q90 quantile models for the 80% prediction interval.

04

explainer

Feature Impact Heuristic

drivers

Ranks local drivers using feature importance times deviation from dataset medians.

tools and models

Components behind the demo

classifier

Block 2 Router

segment

Uses known smoker status directly, or estimates smoker probability for unknown status.

model

Subgroup Random Forests

annual USD

Loads the original smoker and non-smoker Random Forest regressor artifacts.

uncertainty

Quantile Regression

q10-q90

Uses the original q10/q50/q90 quantile models for the 80% prediction interval.

explainer

Feature Impact Heuristic

drivers

Ranks local drivers using feature importance times deviation from dataset medians.

example input

Age 35, BMI 27.5, one child, female, northeast region, unknown smoker status.

final result

The backend returns the original Block 2 routed prediction, q10/q50/q90 interval, subgroup costs, smoker probability, model comparison, and feature-impact table.

limitations

  • The feature-impact chart is the original heuristic, not formal SHAP.
  • The saved models may emit scikit-learn version warnings when loaded in a different environment.
  • Predictions are project outputs and not real underwriting or pricing guidance.