Title
summary
pyks
The goal of pyks is to help do calculation KS statistic for a model.
The R version rawKS is hosted
from GitHub.
Installation
You can install the released version of pyks from Anaconda
Cloud with:
conda install -c jiaxiangbu pyks
or the released version of pyks from Python Package
Index with:
pip install pyks
or the development version from GitHub with:
pip install git+https://github.com/JiaxiangBU/pyks
Citations
If you use pyks, I would be very grateful if you can add a citation in your published work. By citing pyks, beyond acknowledging the work, you contribute to make it more visible and guarantee its growing and sustainability. For citation, please use the BibTex or the citation content.
@misc{jiaxiang_li_2019_3351276,
author = {Jiaxiang Li},
title = {JiaxiangBU/pyks: pyks 1.1.3},
month = jul,
year = 2019,
doi = {10.5281/zenodo.3351276},
url = {https://doi.org/10.5281/zenodo.3351276}
}Jiaxiang Li. (2019, July 25). JiaxiangBU/pyks: pyks 1.1.3 (Version v1.1.3). Zenodo. http://doi.org/10.5281/zenodo.3351276
Disclaimers
Code of Conduct
Please note that the pyks project is released with a Contributor Code
of Conduct.
By contributing to this
project, you agree to abide by its terms.
License
MIT \u00a9 Jiaxiang Li
Examples
import pandas as pd
import numpy as npdf1 = pd.read_csv('refs/two_class_example.csv')from pyKS.ks import perfperf(df1).chart()0.727689153693382
The function `plot` is depreciated, use `perf.plot()`
<Figure size 432x288 with 0 Axes>
perf(df1).table()The function `summary` is depreciated, use `perf.table()`
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
| min_scr | max_scr | bads | goods | total | odds | bad_rate | ks | max_ks | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 1.794262e-07 | 0.002773 | 50 | 0 | 50 | 0.00 | 100.00% | 20.66 | |
| 1 | 2.810221e-03 | 0.036310 | 49 | 1 | 50 | 0.02 | 98.00% | 40.52 | |
| 2 | 3.670582e-02 | 0.122027 | 43 | 7 | 50 | 0.16 | 86.00% | 55.58 | |
| 3 | 1.225460e-01 | 0.325715 | 37 | 13 | 50 | 0.35 | 74.00% | 65.83 | |
| 4 | 3.269821e-01 | 0.655164 | 31 | 19 | 50 | 0.61 | 62.00% | 71.27 | <---- |
| 5 | 6.587248e-01 | 0.853443 | 22 | 28 | 50 | 1.27 | 44.00% | 69.51 | |
| 6 | 8.561391e-01 | 0.958957 | 7 | 43 | 50 | 6.14 | 14.00% | 55.74 | |
| 7 | 9.623505e-01 | 0.987179 | 1 | 49 | 50 | 49.00 | 2.00% | 37.16 | |
| 8 | 9.875471e-01 | 0.997897 | 2 | 48 | 50 | 24.00 | 4.00% | 19.38 | |
| 9 | 9.979229e-01 | 0.999997 | 0 | 50 | 50 | inf | 0.00% | -0.00 |
