Skip to main content

Monotonic Binning for Credit Rating Models

Project description

monobinpy

The goal of the monobinpy package is to perform monotonic binning of numeric risk factor in credit rating models (PD, LGD, EAD) development. All functions handle both binary and continuous target variable. Missing values and other possible special values are treated separately from so-called complete cases. This is replica of monobin R package.

Installation

To install pypi.org version run the following code:

pip install monobinpy

and to install development (github) version run:

pip install git+https://github.com/andrija-djurovic/monobinpy.git#egg=monobinpy

Example

This is a basic example which shows you how to solve a problem of monotonic binning of numeric risk factors:

import monobinpy as mb
import pandas as pd
import numpy as np

url = "https://raw.githubusercontent.com/andrija-djurovic/monobinpy/main/gcd.csv"
gcd = pd.read_csv(filepath_or_buffer = url)
gcd.head()

res = mb.sts_bin(x = gcd.age.copy(), y = gcd.qual.copy())
res[0]
res[1].value_counts().sort_index()

Besides above example, additional five binning algorithms are available. For details and additional description please check:

help(mb) 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monobinpy-0.0.1.tar.gz (12.6 kB view hashes)

Uploaded Source

Built Distribution

monobinpy-0.0.1-py3-none-any.whl (19.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page