Tools to compute and visualize ROC curves.
Project description
roc-utils
This Python package provides tools to compute and visualize ROC curves. ROC curves can be used to graphically assess the diagnostic ability of binary classifiers.
Installation:
pip install roc-utils
To quickly test the installation, use the following cals
python -c "import roc_utils; print(roc_utils.__version__)"
python -c "import roc_utils; roc_utils.demo_bootstrap()"
Usage:
import numpy as np
import matplotlib.pyplot as plt
from roc_utils import *
def sample_data(n1, mu1, std1, n2, mu2, std2, seed=42):
rng = np.random.RandomState(seed)
# sample size, mean, std
x1 = rng.normal(mu1, std1, n1)
x2 = rng.normal(mu2, std2, n2)
y1 = np.zeros(n1, dtype=bool)
y2 = np.ones(n2, dtype=bool)
x = np.concatenate([x1,x2])
y = np.concatenate([y1,y2])
return x, y
x, y = sample_data(n1=300, mu1=0.0, std1=0.5,
n2=300, mu2=1.0, std2=0.7)
pos_label = True
roc = compute_roc(X=x, y=y, pos_label=pos_label)
plot_roc(roc, label="Sample data", color="red")
plt.show()
See examples/tutorial.ipynb for a more detailed introduction.
Build
To build the package, use the following
git clone https://github.com/hirsch-lab/roc-utils.git
cd roc-utils
python setup.py sdist bdist_wheel
python tests/test_all.py
python examples/examples.py
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
roc_utils-0.2.1.tar.gz
(765.1 kB
view hashes)
Built Distribution
roc_utils-0.2.1-py3-none-any.whl
(18.4 kB
view hashes)
Close
Hashes for roc_utils-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4f324bbae0de1e7ae98a11e9655077b97aac558d74632d1b2deea61e81b1ca3 |
|
MD5 | e4fed8f06285af58d827708731ae8ccc |
|
BLAKE2b-256 | 5816da708ae7b0bb3f77231926b105319f683f43c701a2a3dd75690ebadde4aa |