Created
May 8, 2019 01:42
-
-
Save statcompute/5792105dc095d2f2053fbcd69dbf55d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df <- readRDS("archive/accepts.rds") | |
head(df, 1) | |
# bankruptcy bad app_id tot_derog tot_tr age_oldest_tr tot_open_tr tot_rev_tr tot_rev_debt tot_rev_line rev_util bureau_score purch_price msrp | |
# 0 0 1001 6 7 46 NaN NaN NaN NaN 0 747 19678 17160 | |
# down_pyt purpose loan_term loan_amt ltv tot_income used_ind weight | |
# 947.15 LEASE 36 18730.85 109 4800 0 4.75 | |
### BY ITERATIVE PARTITION ### | |
source("wqtl_bin.R") | |
wqtl_bin(df, bad, tot_open_tr, weight) | |
# bin rule cnt freq dist mv_wt bad_freq bad_rate woe iv ks | |
# 00 is.na($X) 1416 5398.50 0.2323 5398.5 354 0.0656 0.2573 0.0173 6.7157 | |
# 01 $X <= 6 2994 12050.25 0.5185 0.0 579 0.0480 -0.0722 0.0026 3.0908 | |
# 02 $X > 6 1427 5792.00 0.2492 0.0 263 0.0454 -0.1315 0.0041 0.0000 | |
### BY GENERALIZED BOOSTED MODEL ### | |
source("wgbm_bin.R") | |
wgbm_bin(df, bad, tot_open_tr, weight) | |
# bin rule cnt freq dist mv_wt bad_freq bad_rate woe iv ks | |
# 00 is.na($X) 1416 5398.50 0.2323 5398.5 354 0.0656 0.2573 0.0173 6.7157 | |
# 01 $X <= 2 525 2085.00 0.0897 0.0 109 0.0523 0.0166 0.0000 6.8658 | |
# 02 $X > 2 & $X <= 3 605 2408.75 0.1036 0.0 124 0.0515 0.0004 0.0000 6.8695 | |
# 03 $X > 3 & $X <= 5 1319 5342.75 0.2299 0.0 246 0.0460 -0.1169 0.0030 4.3181 | |
# 04 $X > 5 & $X <= 14 1899 7696.50 0.3312 0.0 353 0.0459 -0.1210 0.0046 0.5213 | |
# 05 $X > 14 73 309.25 0.0133 0.0 10 0.0323 -0.4846 0.0025 0.0000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment