haberman
Study conducted between 1958 and 1970 at the University of Chicago’s Billings Hospital on the survival of patients who had undergone surgery for breast cancer.
Goal: predict whether a patient survived after undergoing surgery for breast cancer.
hab_metrics <- metric_set(accuracy, precision, recall)
lr_fit |> augment(new_data = hab_test) |>
roc_auc(truth = Survival, .pred_Died) |> kable()
.metric | .estimator | .estimate |
---|---|---|
roc_auc | binary | 0.7284879 |
lr_fit |> augment(new_data = hab_test) |>
hab_metrics(truth = Survival, estimate = .pred_class) |> kable()
.metric | .estimator | .estimate |
---|---|---|
accuracy | binary | 0.7692308 |
precision | binary | 0.8000000 |
recall | binary | 0.1904762 |
.metric | .estimator | .estimate |
---|---|---|
roc_auc | binary | 0.7343358 |
.metric | .estimator | .estimate |
---|---|---|
roc_auc | binary | 0.7243108 |
.metric | .estimator | .estimate |
---|---|---|
roc_auc | binary | 0.7251462 |
.metric | .estimator | .estimate |
---|---|---|
accuracy | binary | 0.7692308 |
precision | binary | 0.5714286 |
recall | binary | 0.5714286 |
.metric | .estimator | .estimate |
---|---|---|
accuracy | binary | 0.7435897 |
precision | binary | 0.5217391 |
recall | binary | 0.5714286 |
hab_scores <- metric_set(brier_class, mn_log_loss, roc_auc)
all_scores <- lr_fit |> augment(new_data = hab_test) |> hab_scores(truth = Survival, .pred_Died) |> mutate(model = "Logistic") |>
bind_rows(oversamp_fit |> augment(new_data = hab_test) |> hab_scores(truth = Survival, .pred_Died) |> mutate(model = "Oversample")) |>
bind_rows(downsamp_fit |> augment(new_data = hab_test) |> hab_scores(truth = Survival, .pred_Died) |> mutate(model = "Undersample")) |>
bind_rows(smote_fit |> augment(new_data = hab_test) |> hab_scores(truth = Survival, .pred_Died) |> mutate(model = "SMOTE")) |>
bind_rows(weighted_fit |> augment(new_data = hab_test) |> hab_scores(truth = Survival, .pred_Died) |> mutate(model = "Weighted"))
all_scores |>
select(-.estimator) |>
pivot_wider(names_from = .metric, values_from = .estimate) |>
kable()
model | brier_class | mn_log_loss | roc_auc |
---|---|---|---|
Logistic | 0.1678374 | 0.5161121 | 0.7284879 |
Oversample | 0.2115716 | 0.6217420 | 0.7343358 |
Undersample | 0.2130135 | 0.6298389 | 0.7243108 |
SMOTE | 0.2169736 | 0.6304324 | 0.7251462 |
Weighted | 0.2599917 | 0.7217460 | 0.7142857 |