All Projects → ShichenXie → Scorecardpy

ShichenXie / Scorecardpy

Licence: mit
Scorecard Development in python, 评分卡

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Scorecardpy

generate-changelog
generates changelog from git based on jira tickets
Stars: ✭ 18 (-95.84%)
Mutual labels:  release
Releaser Tools
Create a GitHub/GitLab/etc. release using a project's commit messages and metadata.
Stars: ✭ 283 (-34.64%)
Mutual labels:  release
Githubupdates
Cocoa framework to install application updates from GitHub releases.
Stars: ✭ 393 (-9.24%)
Mutual labels:  release
glare
gracefully download (latest) releases from GitHub
Stars: ✭ 64 (-85.22%)
Mutual labels:  release
Python Semver
Python package to work with Semantic Versioning (http://semver.org/)
Stars: ✭ 264 (-39.03%)
Mutual labels:  release
Gh Action Pypi Publish
GitHub Action, for publishing distribution files to PyPI
Stars: ✭ 317 (-26.79%)
Mutual labels:  release
vlsi-release-plugins
A set of plugins to simplify Gradle release tasks
Stars: ✭ 30 (-93.07%)
Mutual labels:  release
React Native Version
🔢 Version your React Native or Expo app in a `npm version` fashion.
Stars: ✭ 408 (-5.77%)
Mutual labels:  release
Cli
🆑📍 Setup automated semver compliant package publishing
Stars: ✭ 272 (-37.18%)
Mutual labels:  release
Axion Release Plugin
Gradle release & version management plugin.
Stars: ✭ 372 (-14.09%)
Mutual labels:  release
go-github-release
Guide to release automation
Stars: ✭ 72 (-83.37%)
Mutual labels:  release
release-auth
Handles the authentication for `release`
Stars: ✭ 20 (-95.38%)
Mutual labels:  release
Rolling Rhino
Rolling Rhino; convert Ubuntu into a rolling release. As seen on YouTube 📺
Stars: ✭ 322 (-25.64%)
Mutual labels:  release
natuna-fivem
Typescript/Javascript Bundled FiveM Framework with single module engine that runs on Javascript runtime. Powered with NodeJS.
Stars: ✭ 21 (-95.15%)
Mutual labels:  release
Devops Readme.md
What to Read to Learn More About DevOps
Stars: ✭ 398 (-8.08%)
Mutual labels:  release
perfekt
Release, changelog and version your packages with perfe(k)t 👌 ease!
Stars: ✭ 15 (-96.54%)
Mutual labels:  release
Python Semantic Release
Automatic semantic versioning for python projects
Stars: ✭ 301 (-30.48%)
Mutual labels:  release
Release It
🚀 Automate versioning and package publishing
Stars: ✭ 4,773 (+1002.31%)
Mutual labels:  release
Environmentswitcher
🔥No repackage, switch environment with one click.(无需重新打包,一键切换环境 )
Stars: ✭ 401 (-7.39%)
Mutual labels:  release
Bump
Bump updates the project's version, updates/creates the changelog, makes the bump commit, tags the bump commit and makes the release to GitHub. Opinionated but configurable.
Stars: ✭ 327 (-24.48%)
Mutual labels:  release

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:

# 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
dt_s = sc.var_filter(dat, y="creditability")

# breaking dt into train and test
train, test = sc.split_df(dt_s, 'creditability').values()

# woe binning ------
bins = sc.woebin(dt_s, y="creditability")
# sc.woebin_plot(bins)

# binning adjustment
# # adjust breaks interactively
# breaks_adj = sc.woebin_adj(dt_s, "creditability", bins) 
# # or specify breaks manually
breaks_adj = {
    'age.in.years': [26, 35, 40],
    'other.debtors.or.guarantors': ["none", "co-applicant%,%guarantor"]
}
bins_adj = sc.woebin(dt_s, y="creditability", breaks_list=breaks_adj)

# converting train and test into woe values
train_woe = sc.woebin_ply(train, bins_adj)
test_woe = sc.woebin_ply(test, bins_adj)

y_train = train_woe.loc[:,'creditability']
X_train = train_woe.loc[:,train_woe.columns != 'creditability']
y_test = test_woe.loc[:,'creditability']
X_test = test_woe.loc[:,train_woe.columns != 'creditability']

# logistic regression ------
from sklearn.linear_model import LogisticRegression
lr = LogisticRegression(penalty='l1', C=0.9, solver='saga', n_jobs=-1)
lr.fit(X_train, y_train)
# lr.coef_
# lr.intercept_

# predicted proability
train_pred = lr.predict_proba(X_train)[:,1]
test_pred = lr.predict_proba(X_test)[:,1]

# performance ks & roc ------
train_perf = sc.perf_eva(y_train, train_pred, title = "train")
test_perf = sc.perf_eva(y_test, test_pred, title = "test")

# score ------
card = sc.scorecard(bins_adj, lr, X_train.columns)
# credit score
train_score = sc.scorecard_ply(train, card, print_step=0)
test_score = sc.scorecard_ply(test, card, print_step=0)

# psi
sc.perf_psi(
  score = {'train':train_score, 'test':test_score},
  label = {'train':y_train, 'test':y_test}
)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].