scorecardpy

Scorecard Development in python, 评分卡

https://github.com/shichenxie/scorecardpy

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 (8.6%) to scientific vocabulary

Keywords

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

Repository

Scorecard Development in python, 评分卡

Basic Info
Statistics
  • Stars: 750
  • Watchers: 36
  • Forks: 306
  • Open Issues: 36
  • Releases: 0
Topics
binning credit-scoring python release scorecard woe woebinning
Created almost 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Funding License

README.md

scorecardpy

PyPI version PyPI release Downloads Downloads

This package is python version of R package scorecard. Its goal is to make the development of traditional credit risk scorecard model easier and efficient by providing functions for some common tasks. - data partition (split_df) - variable selection (iv, var_filter) - weight of evidence (woe) binning (woebin, woebin_plot, woebin_adj, woebin_ply) - scorecard scaling (scorecard, scorecard_ply) - performance evaluation (perf_eva, perf_psi)

Installation

  • Install the release version of scorecardpy from PYPI with: pip install scorecardpy

  • Install the latest version of scorecardpy from github with: pip install git+git://github.com/shichenxie/scorecardpy.git

Example

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

``` python

Traditional Credit Scoring Using Logistic Regression

import scorecardpy as sc

data prepare ------

load germancredit data

dat = sc.germancredit()

filter variable via missing rate, iv, identical value rate

dts = sc.varfilter(dat, y="creditability")

breaking dt into train and test

train, test = sc.splitdf(dts, 'creditability').values()

woe binning ------

bins = sc.woebin(dt_s, y="creditability")

sc.woebin_plot(bins)

binning adjustment

# adjust breaks interactively

breaksadj = sc.woebinadj(dt_s, "creditability", bins)

# or specify breaks manually

breaksadj = { 'age.in.years': [26, 35, 40], 'other.debtors.or.guarantors': ["none", "co-applicant%,%guarantor"] } binsadj = sc.woebin(dts, y="creditability", breakslist=breaks_adj)

converting train and test into woe values

trainwoe = sc.woebinply(train, binsadj) testwoe = sc.woebinply(test, binsadj)

ytrain = trainwoe.loc[:,'creditability'] Xtrain = trainwoe.loc[:,trainwoe.columns != 'creditability'] ytest = testwoe.loc[:,'creditability'] Xtest = testwoe.loc[:,trainwoe.columns != 'creditability']

logistic regression ------

from sklearn.linearmodel import LogisticRegression lr = LogisticRegression(penalty='l1', C=0.9, solver='saga', njobs=-1) lr.fit(Xtrain, ytrain)

lr.coef_

lr.intercept_

predicted proability

trainpred = lr.predictproba(Xtrain)[:,1] testpred = lr.predictproba(Xtest)[:,1]

performance ks & roc ------

trainperf = sc.perfeva(ytrain, trainpred, title = "train") testperf = sc.perfeva(ytest, testpred, title = "test")

score ------

card = sc.scorecard(binsadj, lr, Xtrain.columns)

credit score

trainscore = sc.scorecardply(train, card, printstep=0) testscore = sc.scorecardply(test, card, printstep=0)

psi

sc.perfpsi( score = {'train':trainscore, 'test':testscore}, label = {'train':ytrain, 'test':y_test} ) ```

Owner

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

GitHub Events

Total
  • Issues event: 4
  • Watch event: 41
  • Fork event: 9
Last Year
  • Issues event: 4
  • Watch event: 41
  • Fork event: 9

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 115
  • Total Committers: 7
  • Avg Commits per committer: 16.429
  • Development Distribution Score (DDS): 0.165
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
shichenxie s****e@q****m 96
xiaohang 3****g 7
Cristián Bravo c****o@u****a 6
zk403 3****3@q****m 3
foookinaaa 7****a 1
Surya U s****7@g****m 1
zhangjian9@xiaomi.com z****9@x****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 97
  • Total pull requests: 19
  • Average time to close issues: 6 months
  • Average time to close pull requests: 4 months
  • Total issue authors: 82
  • Total pull request authors: 13
  • Average comments per issue: 2.79
  • Average comments per pull request: 1.21
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • hanzigs (5)
  • loveis98 (5)
  • billy-odera (4)
  • sunrisehang (3)
  • autogluonisgod (2)
  • SenHan-lionheart (2)
  • zeng8280 (1)
  • sasistician (1)
  • BenjaLeh (1)
  • ChenSir99 (1)
  • vancities (1)
  • suiyilalala (1)
  • chenbofeng123 (1)
  • Migalvao (1)
  • divatemangesh (1)
Pull Request Authors
  • sunrisehang (6)
  • ShichenXie (2)
  • williamberrios (1)
  • Mensyne (1)
  • zk403 (1)
  • lvyin1122 (1)
  • baiziru (1)
  • huangxianyang (1)
  • CBravoR (1)
  • SuryaXanden (1)
  • microwo (1)
  • foookinaaa (1)
  • evgenykurbatov (1)
Top Labels
Issue Labels
question (6)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 11,963 last-month
  • Total dependent packages: 4
  • Total dependent repositories: 12
  • Total versions: 10
  • Total maintainers: 1
pypi.org: scorecardpy

Credit Risk Scorecard

  • Versions: 10
  • Dependent Packages: 4
  • Dependent Repositories: 12
  • Downloads: 11,963 Last month
Rankings
Downloads: 1.7%
Dependent packages count: 2.4%
Stargazers count: 2.4%
Average: 2.7%
Forks count: 3.0%
Dependent repos count: 4.2%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • matplotlib *
  • numpy *
  • pandas >=0.25.0
  • patsy *
  • scikit-learn >=0.19.1
  • statsmodels *