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", ...)

Arguments

bins

Binning information generated from woebin function.

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.

Value

A list of scorecard data frames

Examples

# \donttest{
# load germancredit data
data("germancredit")
# filter variable via missing rate, iv, identical value rate
dtvf = var_filter(germancredit, "creditability")
#>  Filtering variables via missing_rate, identical_rate, info_value ...
#>  1 variables are removed via identical_rate
#>  6 variables are removed via info_value
#>  Variable filtering on 1000 rows and 20 columns in 00:00:00
#>  7 variables are removed in total
# split into train and test
dtlst = split_df(dtvf, y = 'creditability')
# binning
bins = woebin(dtlst$train, "creditability")
#>  Creating woe binning ...
#>  Binning on 681 rows and 14 columns in 00:00:00

# 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)

# }