scorecard

Scorecard Development in R, 评分卡

https://github.com/shichenxie/scorecard

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary

Keywords

binning credit-scoring r release scorecard woe woebinning
Last synced: 6 months ago · JSON representation

Repository

Scorecard Development in R, 评分卡

Basic Info
Statistics
  • Stars: 164
  • Watchers: 17
  • Forks: 63
  • Open Issues: 2
  • Releases: 0
Topics
binning credit-scoring r release scorecard woe woebinning
Created over 8 years ago · Last pushed 6 months ago
Metadata Files
Readme Funding License

README.md

scorecard

CRAN\_Status\_Badge

The goal of scorecard package is to make the development of the traditional credit risk scorecard model easier and efficient by providing functions for some common tasks that summarized in below. This package can also used in the development of machine learning models on binary classification.

  • data preprocessing (split_df, replace_na, one_hot, var_scale)
  • weight of evidence (woe) binning (woebin, woebin_plot, woebin_adj, woebin_ply)
  • variable selection (var_filter, iv, vif)
  • performance evaluation (perf_eva, perf_cv, perf_psi)
  • scorecard scaling (scorecard, scorecard2, scorecard_ply)
  • scorecard report (gains_table, report)

Installation

  • Install the release version of scorecard from CRAN with: r install.packages("scorecard")

  • Install the latest version of scorecard from github with: ``` r

    install.packages("devtools")

    devtools::install_github("shichenxie/scorecard") ```

Example

This is a basic example which shows you how to develop a common credit risk scorecard:

``` r

Traditional Credit Scoring Using Logistic Regression

library(scorecard)

data preparing ------

load germancredit data

data("germancredit")

filter variable via missing rate, iv, identical value rate

dtf = varfilter(germancredit, y="creditability")

breaking dt into train and test

dtlist = splitdf(dtf, y="creditability", ratios = c(0.6, 0.4), seed = 30) labellist = lapply(dt_list, function(x) x$creditability)

woe binning ------

bins = woebin(dt_f, y="creditability")

woebin_plot(bins)

binning adjustment

adjust breaks interactively

breaksadj = woebinadj(dt_f, "creditability", bins)

or specify breaks manually

breaksadj = list( age.in.years=c(26, 35, 40), other.debtors.or.guarantors=c("none", "co-applicant%,%guarantor")) binsadj = woebin(dtf, y="creditability", breakslist=breaks_adj)

converting train and test into woe values

dtwoelist = lapply(dtlist, function(x) woebinply(x, bins_adj))

glm / selecting variables ------

m1 = glm( creditability ~ ., family = binomial(), data = dtwoelist$train)

vif(m1, merge_coef = TRUE) # summary(m1)

Select a formula-based model by AIC (or by LASSO for large dataset)

mstep = step(m1, direction="both", trace = FALSE) m2 = eval(mstep$call)

vif(m2, merge_coef = TRUE) # summary(m2)

performance ks & roc ------

predicted proability

predlist = lapply(dtwoe_list, function(x) predict(m2, x, type='response'))

Adjusting for oversampling (support.sas.com/kb/22/601.html)

cardprobadj = scorecard2(binsadj, dt=dtlist$train, y='creditability',

x=sub('woe$','',names(coef(m2))[-1]), badprobpop=0.03, return_prob=TRUE)

performance

perf = perfeva(pred = predlist, label = label_list)

perfadj = perfeva(pred = cardprobadj$prob, label = label_list$train)

score ------

scorecard

card = scorecard(bins_adj, m2)

credit score

scorelist = lapply(dtlist, function(x) scorecard_ply(x, card))

psi

perfpsi(score = scorelist, label = label_list)

make cutoff decisions -----

gains table

gtbl = gainstable(score = unlist(scorelist), label = unlist(label_list))

```

Owner

  • Name: Shichen
  • Login: ShichenXie
  • Kind: user
  • Location: Beijing, China

GitHub Events

Total
  • Issues event: 4
  • Watch event: 7
  • Issue comment event: 3
  • Push event: 3
  • Fork event: 1
Last Year
  • Issues event: 4
  • Watch event: 7
  • Issue comment event: 3
  • Push event: 3
  • Fork event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 436
  • Total Committers: 7
  • Avg Commits per committer: 62.286
  • Development Distribution Score (DDS): 0.018
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
shichenxie s****e@q****m 428
mthomas-ketchbrook 5****k 2
SHICHEN XIE s****e@1****1 2
mattdowle m****e@g****m 1
Miroslav Kondic m****2@g****m 1
Joshua Kunst j****t@g****m 1
Yu Gong a****g@y****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 71
  • Total pull requests: 6
  • Average time to close issues: 17 days
  • Average time to close pull requests: about 15 hours
  • Total issue authors: 49
  • Total pull request authors: 5
  • Average comments per issue: 3.38
  • Average comments per pull request: 1.0
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: 2 months
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 1.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Leo-Lee15 (5)
  • longhua8800w (4)
  • islander22 (4)
  • armgong (3)
  • jbkunst (3)
  • Alexa2371a (3)
  • ptlarsson (3)
  • mrmelchi (2)
  • kevinoden (2)
  • skq642877841 (2)
  • bkochanski (2)
  • jm448 (1)
  • fangxingouyang (1)
  • Pinkmots (1)
  • KingsleyW (1)
Pull Request Authors
  • mthomas-ketchbrook (2)
  • jbkunst (1)
  • mattdowle (1)
  • miroslavftn (1)
  • armgong (1)
Top Labels
Issue Labels
help wanted (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 1,740 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 48
  • Total maintainers: 1
cran.r-project.org: scorecard

Credit Risk Scorecard

  • Versions: 37
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 1,740 Last month
Rankings
Forks count: 1.0%
Stargazers count: 2.7%
Downloads: 9.5%
Average: 13.1%
Dependent repos count: 23.9%
Dependent packages count: 28.7%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: r-scorecard
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 20.5%
Stargazers count: 27.1%
Average: 33.2%
Dependent repos count: 34.0%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • data.table >= 1.10.0 imports
  • doParallel * imports
  • foreach * imports
  • ggplot2 * imports
  • gridExtra * imports
  • openxlsx * imports
  • parallel * imports
  • stringi * imports
  • knitr * suggests
  • pkgdown * suggests
  • rmarkdown * suggests
  • testthat * suggests
inst/extdata/Dockerfile docker
  • rocker/verse latest build