From 2a3f43b660e9f16d00148103b1f4b79c237a32c7 Mon Sep 17 00:00:00 2001
From: Valentin Trophime <valentin.trophime@inria.fr>
Date: Wed, 23 Oct 2024 16:20:52 +0200
Subject: [PATCH] simplify cdf

---
 scripts/heatmap.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/scripts/heatmap.py b/scripts/heatmap.py
index 40cd3d8..1844a8f 100755
--- a/scripts/heatmap.py
+++ b/scripts/heatmap.py
@@ -141,19 +141,15 @@ def plot_likelyhood(path: str, n_iter: int, task_dur: int, reac: int):
             overhead2[i] = (t - base) / base * 100.0
             i += 1
     overhead2.sort()
-    estimated = scipy.stats.ecdf(overhead2)
-    x = np.linspace(-5, 100, 10000)
-    y = estimated.cdf.evaluate(x)
-    plt.plot(x, y, label="ecdf")
-    cdf = scipy.stats.norm.cdf(overhead2)
-    plt.plot(overhead2, cdf, label="cdf")
+    ecdf = np.linspace(0, 1, len(overhead2))
+    plt.plot(overhead2, ecdf, label="ecdf")
     plt.xlabel("x in %")
     plt.xlim([-5, 50])
     plt.ylabel("P(X < x)")
     plt.legend()
     plt.title("Probability than the real overhead is below x")
-    x_95 = x[bisect_left(y, 0.95)]
-    x_99 = x[bisect_left(y, 0.99)]
+    x_95 = overhead2[bisect_left(ecdf, 0.95)]
+    x_99 = overhead2[bisect_left(ecdf, 0.99)]
     print(f"P(Overhead < x) < 95% for x = {x_95}")
     print(f"P(Overhead < x) < 99% for x = {x_99}")
     plt.show()
-- 
GitLab