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 a binary classifier.
Installation:
pip install roc-utils
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/examples.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.1.1.tar.gz
(574.9 kB
view hashes)
Built Distribution
roc_utils-0.1.1-py3-none-any.whl
(17.3 kB
view hashes)
Close
Hashes for roc_utils-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e413b9be12c70c9f410c2df5a08dd4d97744ff2c1d618bfb19839483e460ee97 |
|
MD5 | e772b44734f11dce14a196d4ab3f4b28 |
|
BLAKE2b-256 | 74b773382d789882b8f45936114b344839d77b1f14301d4ac884cee84de270a6 |