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
Repository
Scorecard Development in R, 评分卡
Basic Info
- Host: GitHub
- Owner: ShichenXie
- License: other
- Language: R
- Default Branch: master
- Homepage: http://shichen.name/scorecard
- Size: 15.8 MB
Statistics
- Stars: 164
- Watchers: 17
- Forks: 63
- Open Issues: 2
- Releases: 0
Topics
Metadata Files
README.md
scorecard
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
scorecardfrom CRAN with:r install.packages("scorecard")Install the latest version of
scorecardfrom github with: ``` rinstall.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
- Website: http://shichen.name
- Repositories: 11
- Profile: https://github.com/ShichenXie
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
Top Committers
| Name | 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
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
- Homepage: https://github.com/ShichenXie/scorecard
- Documentation: http://cran.r-project.org/web/packages/scorecard/scorecard.pdf
- License: MIT + file LICENSE
-
Latest release: 0.4.5
published 6 months ago
Rankings
Maintainers (1)
conda-forge.org: r-scorecard
- Homepage: http://shichen.name/scorecard/
- License: MIT
-
Latest release: 0.4.0
published over 3 years ago
Rankings
Dependencies
- 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
- rocker/verse latest build