Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2a3f43b6 authored by TROPHIME Valentin's avatar TROPHIME Valentin
Browse files

simplify cdf

parent d772fa02
No related branches found
No related tags found
No related merge requests found
...@@ -141,19 +141,15 @@ def plot_likelyhood(path: str, n_iter: int, task_dur: int, reac: int): ...@@ -141,19 +141,15 @@ def plot_likelyhood(path: str, n_iter: int, task_dur: int, reac: int):
overhead2[i] = (t - base) / base * 100.0 overhead2[i] = (t - base) / base * 100.0
i += 1 i += 1
overhead2.sort() overhead2.sort()
estimated = scipy.stats.ecdf(overhead2) ecdf = np.linspace(0, 1, len(overhead2))
x = np.linspace(-5, 100, 10000) plt.plot(overhead2, ecdf, label="ecdf")
y = estimated.cdf.evaluate(x)
plt.plot(x, y, label="ecdf")
cdf = scipy.stats.norm.cdf(overhead2)
plt.plot(overhead2, cdf, label="cdf")
plt.xlabel("x in %") plt.xlabel("x in %")
plt.xlim([-5, 50]) plt.xlim([-5, 50])
plt.ylabel("P(X < x)") plt.ylabel("P(X < x)")
plt.legend() plt.legend()
plt.title("Probability than the real overhead is below x") plt.title("Probability than the real overhead is below x")
x_95 = x[bisect_left(y, 0.95)] x_95 = overhead2[bisect_left(ecdf, 0.95)]
x_99 = x[bisect_left(y, 0.99)] x_99 = overhead2[bisect_left(ecdf, 0.99)]
print(f"P(Overhead < x) < 95% for x = {x_95}") print(f"P(Overhead < x) < 95% for x = {x_95}")
print(f"P(Overhead < x) < 99% for x = {x_99}") print(f"P(Overhead < x) < 99% for x = {x_99}")
plt.show() plt.show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment