# \donttest{
# Mock data representing a binned feature
df_binned <- data.frame(
feature = c(10, 20, 30, 10, 20, 50),
bin = c("Low", "Mid", "High", "Low", "Mid", "High"),
woe = c(-0.5, 0.2, 1.1, -0.5, 0.2, 1.1),
idbin = c(1, 2, 3, 1, 2, 3)
)
target <- c(0, 0, 1, 1, 0, 1)
# Calculate gains table grouped by bin ID
gt <- ob_gains_table_feature(df_binned, target, group_var = "idbin")
# Inspect key metrics
print(gt[, c("id", "count", "pos_rate", "lift", "js_divergence")])
# }
Run the code above in your browser using DataLab