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.0.tar.gz
(765.1 kB
view hashes)
Built Distribution
roc_utils-0.2.0-py3-none-any.whl
(18.4 kB
view hashes)
Close
Hashes for roc_utils-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 100112ba5fac7e170e627fb9fc11f4a88bb3ebadb4e7a1b57a467b1b9bbb4fa9 |
|
MD5 | 9ecf61bb99c02bc7c8813acaa32e38bb |
|
BLAKE2b-256 | 66d71dae8693b4060cff1b02e1e395492818e1af1ec9e2682f92e1788a78884a |