Title: | Easily Get True-Positive Rate and False-Positive Rate and KS Statistic |
---|---|
Description: | The Kolmogorov-Smirnov (K-S) statistic is a standard method to measure the model strength for credit risk scoring models. This package calculates the K–S statistic and plots the true-positive rate and false-positive rate to measure the model strength. This package was written with the credit marketer, who uses risk models in conjunction with his campaigns. The users could read more details from Thrasher (1992) <doi:10.1002/dir.4000060408> and 'pyks' <https://pypi.org/project/pyks/>. |
Authors: | Jiaxiang Li [aut, cre] |
Maintainer: | Jiaxiang Li <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-04 04:03:56 UTC |
Source: | https://github.com/jiaxiangbu/rawks |
Plot KS chart
ks_plot(df)
ks_plot(df)
df |
data.frame created by |
The 'ggplot2' object
data("two_class_example_edited") max(ks_table(two_class_example_edited$yhat, two_class_example_edited$y)$ks) ks_table(two_class_example_edited$yhat, two_class_example_edited$y) %>% ks_plot()
data("two_class_example_edited") max(ks_table(two_class_example_edited$yhat, two_class_example_edited$y)$ks) ks_table(two_class_example_edited$yhat, two_class_example_edited$y) %>% ks_plot()
Output a data.frame
with inputs (y, yhat) and tpr, fpr and ks.
ks_table(yhat, y)
ks_table(yhat, y)
yhat |
numeric the value predicted by your model. |
y |
numeric the target values. |
The data frame containing tpr, fpr and ks.
data("two_class_example_edited") max(ks_table(two_class_example_edited$yhat, two_class_example_edited$y)$ks)
data("two_class_example_edited") max(ks_table(two_class_example_edited$yhat, two_class_example_edited$y)$ks)
A dataset containing two columns, yhat
and y
as
the inputs for the function ks_table
.
two_class_example_edited
two_class_example_edited
A data frame with 500 rows and 2 variables:
predictions
target
package yardstick::two_class_example