Description Usage Arguments Value Examples
Code WOE value for each band of variable.
1 | codeWOE(x, xVar)
|
x |
An object of Clusterrr class |
xVar |
A vector of variable to match with WOE |
Vector with coded WOE values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | data(lendclub)
x <- doClustering(lendclub, "grade", "loan_status")
codeWOE(x, lendclub$grade)
#how to build fast model using package?
#assuming 2 characteristic was chosen to build a logistic regression model:
x <- doClustering(lendclub, "purpose", "loan_status")
purposeCoded <- codeWOE(x, lendclub$purpose)
x <- doClustering(lendclub, "grade", "loan_status")
gradeCoded <- codeWOE(x, lendclub$grade)
dt <- data.frame(y = lendclub$loan_status,
x1 = purposeCoded,
x2 = gradeCoded)
#divide population into 2 sets for learning and validation:
dt.train <- dt[1:500000,]
dt.test <- dt[500000:nrow(lendclub),]
#build fast model:
model <- glm(data = dt.train, formula = y ~ x1 + x2, family = "binomial")
dt.test$prediction <- predict(model, dt.test, type = "response")
#check the strength of fit:
#pROC::auc(ifelse(dt.test$y,1,0), dt.test$prediction ) * 2 - 1 #gini
#pROC::plot.roc(ifelse(dt.test$y,1,0), dt.test$prediction ) # ROC curve
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.