summaryrefslogtreecommitdiffstats
path: root/cholerab
diff options
context:
space:
mode:
Diffstat (limited to 'cholerab')
-rw-r--r--cholerab/bloat/vodka-korn/shell.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/cholerab/bloat/vodka-korn/shell.nix b/cholerab/bloat/vodka-korn/shell.nix
new file mode 100644
index 00000000..82375bb6
--- /dev/null
+++ b/cholerab/bloat/vodka-korn/shell.nix
@@ -0,0 +1,36 @@
+{ pkgs ? import <nixpkgs> {} }:
+pkgs.mkShell {
+ packages = [
+ (pkgs.writers.writePython3Bin "run" {
+ libraries = [
+ pkgs.python3Packages.numpy
+ pkgs.python3Packages.scipy
+ ];
+ } /* py */ ''
+ import numpy as np
+ from scipy.stats import fisher_exact
+ SIGNIFICANCE = 0.05
+
+ # ↓truth| KORN | VODKA |←guess
+ # ------------------------
+ # KORN | a | b |
+ # VODKA | c | d |
+
+ a = 4
+ b = 0
+ c = 0
+ d = 4
+
+ _, p_value = fisher_exact(np.array([[a, b], [c, d]], np.int32))
+
+ print("Scientists have found out", end=": ")
+
+ if p_value < SIGNIFICANCE:
+ print("korn != vodka.")
+ else:
+ print("korn == vodka.")
+
+ print(f"p-value: {p_value} (threshold: {SIGNIFICANCE})")
+ '')
+ ];
+}