From 79f6335fd037684fc1411707ba96f43789388694 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:33:39 +0100 Subject: [PATCH] Create README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- numpy/roc/README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 numpy/roc/README.md diff --git a/numpy/roc/README.md b/numpy/roc/README.md new file mode 100644 index 0000000..1822378 --- /dev/null +++ b/numpy/roc/README.md @@ -0,0 +1,54 @@ +# ROC +{:.no_toc} + + + +## Top + +Questions to [David Rotermund](mailto:davrot@uni-bremen.de) + +## Test data + +```python +import numpy as np +import matplotlib.pyplot as plt + +rng = np.random.default_rng(1) + +a_x = rng.normal(1.5, 1.0, size=(5000)) +b_x = rng.normal(0.0, 1.0, size=(5000)) + + +ab_x = np.concatenate([a_x, b_x]) +edges = np.histogram_bin_edges(ab_x, bins=100, range=None, weights=None) + +h_a, _ = np.histogram(a_x, bins=edges) +h_b, _ = np.histogram(b_x, bins=edges) + +h_a = h_a.astype(np.float32) +h_b = h_b.astype(np.float32) + +h_a /= h_a.sum() +h_b /= h_b.sum() + +edges = (edges[1:] + edges[:-1]) / 2.0 + +plt.plot(edges, h_a, "c.", label="Class -1") +plt.plot(edges, h_b, "m.", label="Class +1") +plt.ylabel("Probability of a value") +plt.ylabel("Edge center") +plt.legend() +plt.show() +``` + +!(Image1)[image1.png] + +```python +``` + + +```shell +```