Views
No views yet
Note on Prediction Type: The models are trained for prospective prediction — they use demographic context and lagged clinical history available prior to or at admission (prediction-year demographics plus prior-year/lagged conditions) to predict outcomes for that inpatient stay.
2023_prospective_inpatient_models_bundle.pkl — Serialized bundle with trained models, per-target feature lists, discharge label encoder, and LOS calibration factor:
los_model (XGBoost, Gamma objective + early stopping)readmission_model (Logistic Regression + isotonic calibration)discharge_model (Multinomial Logistic Regression + sigmoid calibration)feature_columns_los, feature_columns_readmission, feature_columns_dischargele_discharge, los_calibration_factor, model_run_idinpatient_models_prospective_train.py — Training script that builds features from BENCHMARKS_INPATIENT_INPUT_PROSPECTIVE, trains the three models with optional greedy feature selection, logs metrics/feature frequency/importances to Snowflake, and uploads the bundle to a Snowflake stage.inpatient_models_prospective_predict.py — Prediction script that downloads the bundle from stage, prepares features, generates predictions (including per-class discharge probabilities), writes predictions to Snowflake, and logs evaluation metrics.prosp_inpatient_model_eval_metrics_train.csv — Long-format training metrics exported from Snowflake for LOS, Readmission, and Discharge.prosp_inpatient_model_feature_frequency.csv — Feature prevalence diagnostics computed on the training matrix.PROSP_FEATURE_FREQUENCY, PROSP_MODEL_FEATURE_IMPORTANCE, and PROSP_MODEL_EVAL_METRICS_TRAIN (all under the configured database/schema).prosp_inpatient_model_feature_frequency.csv)| Column | Description |
|---|---|
FEATURE_NAME | The name of the input feature (e.g., age_at_admit, cond_hypertension). |
POSITIVE_COUNT | The number of records in the training set where this feature was present (non-zero). |
TOTAL_ROWS | The total number of records in the training set. |
POSITIVE_RATE_PERCENT | The prevalence or "fill rate" of the feature (POSITIVE_COUNT / TOTAL_ROWS). |
POSITIVE_RATE_PERCENT from this file with the rates from your own prediction input data. Significant discrepancies can indicate data drift or pipeline issues that may degrade model performance.PROSP_MODEL_FEATURE_IMPORTANCE)TARGET_TYPE and TARGET_NAME to review drivers.dbt_project.yml file to control the workflow.false by default.1# in dbt_project.yml
2vars:
3 benchmarks_train: true
4 benchmarks_already_created: truebenchmarks_train: Set to true to build the datasets that the ML models will use for making predictions.benchmarks_already_created: Set to true to ingest model predictions back into the project as a new dbt source.1# in dbt_project.yml
2vars:
3 predictions_inpatient_prospective: "{{ source('benchmark_output', 'inpatient_predictions_prospective') }}"
4sources.ymlsources.yml file includes a definition for the source you referenced above (e.g., benchmark_output) that points to the database and schema where your model's prediction outputs are stored.benchmarks_train enabled. This creates the input data required by the ML model.dbt build --vars '{benchmarks_train: true}'dbt build --select tag:benchmarks_train --vars '{benchmarks_train: true}'inpatient_models_prospective_predict.py to generate predictions. It reads BENCHMARKS_INPATIENT_INPUT_PROSPECTIVE for the configured MODEL_YEAR, downloads the bundle from the Snowflake stage, and writes predictions to PROSP_INPATIENT_PREDICTIONS.benchmarks_already_created enabled. This populates the analytics marts.dbt build --vars '{benchmarks_already_created: true, benchmarks_train: false}'dbt build --select tag:benchmarks_analysis --vars '{benchmarks_already_created: true, benchmarks_train: false}'prediction_year_sex, prediction_year_race, prediction_year_state, ms_drg_code, ccsr_cat.prediction_year_age_at_admit, cold_start, lag_missing (and in prediction script, lag_age_at_admit).LAG_COND_*, LAG_CMS_*, LAG_HCC* columns from the prospective input table.BENCHMARKS_INPATIENT_INPUT_PROSPECTIVE (Snowflake).reg:gamma with early stopping; post-hoc calibration factor applied so predicted sums match validation sums.@MEDICARE_LDS_FIVE_PERCENT.BENCHMARKS.MODEL_STAGE as {MODEL_YEAR}_prospective_inpatient_models_bundle.pkl.