Last active
May 28, 2020 05:00
-
-
Save statcompute/3ceda74ade266bb9d1ee89115ba21833 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
df1 <- read.table("credit_count.txt", header = T, sep = ",") | |
df2 <- df1[which(df1$CARDHLDR == 1), ] | |
Y <- df2$DEFAULT | |
X <- scale(df2[, 3:ncol(df2)]) | |
i <- sample(seq(length(Y)), length(Y) / 2) | |
# WITHOUT BINNING | |
Y1 <- Y[i] | |
Y2 <- Y[-i] | |
X1 <- X[i, ] | |
X2 <- X[-i, ] | |
net11 <- grnn.fit(x = X1, y = Y1) | |
test1 <- grnn.search_auc(net11, gen_latin(1, 3, 10), nfolds = 4) | |
# $best | |
# sigma auc | |
# 2.198381 0.6297201 | |
net12 <- grnn.fit(x = X1, y = Y1, sigma = test1$best$sigma) | |
MLmetrics::AUC(grnn.parpred(net12, X1), Y1) | |
# 0.6855638 | |
MLmetrics::AUC(grnn.parpred(net12, X2), Y2) | |
# 0.6555798 | |
# WITH BINNING | |
df3 <- data.frame(df2[, 3:ncol(df2)], Y) | |
bin_out <- batch_bin(df3, method = 3) | |
df_woe <- batch_woe(df3, bin_out$BinLst) | |
W <- scale(df_woe$df[, -1]) | |
W1 <- W[i, ] | |
W2 <- W[-i, ] | |
net21 <- grnn.fit(x = W1, y = Y1) | |
test2 <- grnn.search_auc(net21, gen_latin(1, 3, 10), nfolds = 4) | |
# $best | |
# sigma auc | |
# 2.198381 0.6820317 | |
net22 <- grnn.fit(x = W1, y = Y1, sigma = test2$best$sigma) | |
MLmetrics::AUC(grnn.parpred(net22, W1), Y1) | |
# 0.7150051 | |
MLmetrics::AUC(grnn.parpred(net22, W2), Y2) | |
# 0.6884229 |
Thank you for your kind word.
The data is here
http://people.stern.nyu.edu/wgreene/Text/Edition7/TableF7-3.txt.
…On Wed, May 27, 2020 at 5:26 AM jasepark2 ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
I found your excellent artile from "
https://statcompute.wordpress.com/2012/12/30/modeling-in-r-with-log-likelihood-function/"
but I have trouble to find the "credit_count.csv" for replication. Could
you let me have the file or link for downloading please?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/3ceda74ade266bb9d1ee89115ba21833#gistcomment-3319695>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDA2WVU2XUROK6JQ5ARJRLRTTTEJANCNFSM4NL765QA>
.
Thank you so much for your kindness.
Jase Park
On Wed, May 27, 2020 at 11:38 PM WenSui Liu <notifications@github.com>
wrote:
… ***@***.**** commented on this gist.
------------------------------
Thank you for your kind word.
The data is here
http://people.stern.nyu.edu/wgreene/Text/Edition7/TableF7-3.txt.
On Wed, May 27, 2020 at 5:26 AM jasepark2 ***@***.***>
wrote:
> ***@***.**** commented on this gist.
> ------------------------------
>
> I found your excellent artile from "
>
https://statcompute.wordpress.com/2012/12/30/modeling-in-r-with-log-likelihood-function/
"
> but I have trouble to find the "credit_count.csv" for replication. Could
> you let me have the file or link for downloading please?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
https://gist.github.com/3ceda74ade266bb9d1ee89115ba21833#gistcomment-3319695
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ABDA2WVU2XUROK6JQ5ARJRLRTTTEJANCNFSM4NL765QA
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/3ceda74ade266bb9d1ee89115ba21833#gistcomment-3320023>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFIWQET4SYJE5DUYSRT7NULRTUQWFANCNFSM4NL765QA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found your excellent artile from "https://statcompute.wordpress.com/2012/12/30/modeling-in-r-with-log-likelihood-function/" but I have trouble to find the "credit_count.csv" for replication. Could you let me have the file or link for downloading please?