scorecard2 | R Documentation |
scorecard2
creates a scorecard based on the results from woebin
. It has the same function of scorecard
, but without model object input and provided adjustment for oversampling.
scorecard2(bins, dt, y, x = NULL, points0 = 600, odds0 = 1/19,
pdo = 50, basepoints_eq0 = FALSE, digits = 0, return_prob = FALSE,
posprob_pop = NULL, posprob_sample = NULL, positive = "bad|1", ...)
bins |
Binning information generated from |
dt |
A data frame with both x (predictor/feature) and y (response/label) variables. |
y |
Name of y variable. |
x |
Name of x variables. If it is NULL, then all variables in bins are used. Defaults to NULL. |
points0 |
Target points, default 600. |
odds0 |
Target odds, default 1/19. Odds = p/(1-p). |
pdo |
Points to Double the Odds, default 50. |
basepoints_eq0 |
Logical, defaults to FALSE. If it is TRUE, the basepoints will equally distribute to each variable. |
digits |
The number of digits after the decimal point for points calculation. Default 0. |
return_prob |
Logical, defaults to FALSE. If it is TRUE, the predict probability will also return. |
posprob_pop |
Positive probability of population. Accepted range: 0-1, default to NULL. If it is not NULL, the model will adjust for oversampling. |
posprob_sample |
Positive probability of sample. Accepted range: 0-1, default to the positive probability of the input dt. |
positive |
Value of positive class, default "bad|1". |
... |
Additional parameters. |
A list of scorecard data frames
scorecard
scorecard_ply
# load germancredit data
data("germancredit")
# filter variable via missing rate, iv, identical value rate
dtvf = var_filter(germancredit, "creditability")
# split into train and test
dtlst = split_df(dtvf, y = 'creditability')
# binning
bins = woebin(dtlst$train, "creditability")
# train only
## create scorecard
card1 = scorecard2(bins=bins, dt=dtlst$train, y='creditability')
## scorecard and predicted probability
cardprob1 = scorecard2(bins=bins, dt=dtlst$train, y='creditability', return_prob = TRUE)
# both train and test
## create scorecard
card2 = scorecard2(bins=bins, dt=dtlst, y='creditability')
## scorecard and predicted probability
cardprob2 = scorecard2(bins=bins, dt=dtlst, y='creditability', return_prob = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.