Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2024-01-05 14:33:23 +01:00 committed by GitHub
parent f6497ea091
commit 771ff58c4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,7 +77,6 @@ If network architectures are tested, typically, the same data set is used in bot
This translates in to the table: [[7, 17], [15, 5]]
```python
from scipy.stats import fisher_exact
@ -86,5 +85,104 @@ print(res.statistic) # -> 0.13725490196078433
print(res.pvalue) # -> 0.0028841933752349743
```
## Network performance analysis
![image1](image1.png)
```python
from scipy.stats import fisher_exact
import numpy as np
import matplotlib.pyplot as plt
N: int = 10000
correct_a: int = N // 2
values = np.arange(0, N + 1, 100)
results_less = np.zeros((values.shape[0]))
results_greater = np.zeros((values.shape[0]))
results_two_sided = np.zeros((values.shape[0]))
for i in range(0, values.shape[0]):
correct_b: int = int(values[i])
res = fisher_exact(
[[N - correct_a, N - correct_b], [correct_a, correct_b]], alternative="less"
)
results_less[i] = res.pvalue
for i in range(0, values.shape[0]):
correct_b = int(values[i])
res = fisher_exact(
[[N - correct_a, N - correct_b], [correct_a, correct_b]], alternative="greater"
)
results_greater[i] = res.pvalue
for i in range(0, values.shape[0]):
correct_b = int(values[i])
res = fisher_exact(
[[N - correct_a, N - correct_b], [correct_a, correct_b]],
alternative="two-sided",
)
results_two_sided[i] = res.pvalue
plt.plot(100.0 * values / N, results_two_sided, label="two-sided")
plt.plot(100.0 * values / N, results_less, label="less")
plt.plot(100.0 * values / N, results_greater, label="greater")
plt.title(f"Compared to a performance A of {100.0 * correct_a /N}%")
plt.ylabel("p-value")
plt.xlabel("Correct [%]")
plt.legend()
plt.show()
```
![image2](image2.png)
```python
from scipy.stats import fisher_exact
import numpy as np
import matplotlib.pyplot as plt
N: int = 10000
correct_a: int = int(N * 0.99)
values = np.arange(int(N * 0.98), N + 1)
results_less = np.zeros((values.shape[0]))
results_greater = np.zeros((values.shape[0]))
results_two_sided = np.zeros((values.shape[0]))
for i in range(0, values.shape[0]):
correct_b: int = int(values[i])
res = fisher_exact(
[[N - correct_a, N - correct_b], [correct_a, correct_b]], alternative="less"
)
results_less[i] = res.pvalue
for i in range(0, values.shape[0]):
correct_b = int(values[i])
res = fisher_exact(
[[N - correct_a, N - correct_b], [correct_a, correct_b]], alternative="greater"
)
results_greater[i] = res.pvalue
for i in range(0, values.shape[0]):
correct_b = int(values[i])
res = fisher_exact(
[[N - correct_a, N - correct_b], [correct_a, correct_b]],
alternative="two-sided",
)
results_two_sided[i] = res.pvalue
plt.plot(100.0 * values / N, results_two_sided, label="two-sided")
plt.plot(100.0 * values / N, results_less, label="less")
plt.plot(100.0 * values / N, results_greater, label="greater")
plt.title(f"Compared to a performance A of {100.0 * correct_a /N}%")
plt.ylabel("p-value")
plt.xlabel("Correct [%]")
plt.legend()
plt.show()
```