about summary refs log tree commit diff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/README.md b/README.md
index af7e7e8d..dcbf7e22 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,56 @@ There are five branches.
         
 
 
+## Headless driver: `bin/bnw`
+
+The web application is not needed to run BNW's computation.  `bin/bnw` does the
+same three-stage pipeline -- `network_score`, the k-best search, `structure` --
+in a private working directory, and writes machine-readable results:
+
+```sh
+# build the C programs once (needs gcc, g++ and R's standalone math library)
+var_lib_genenet_bnw/build.sh
+
+# learn a network: variables x samples, header line first
+bin/bnw learn --input test/golden/six_traits_matrix.tsv
+```
+
+```
+# bnw 0.1.0 variables=6 samples=200 maxparents=4 k=1 tiers=3 threshold=0.5
+from	to	posterior	in_structure
+Trait2	Trait1	1	1
+Trait2	Trait4	1	1
+...
+```
+
+Every candidate edge is reported with its posterior, and `in_structure` says
+whether it survived `--threshold`.  Options: `--maxparents` (default 4),
+`--k` (1), `--tiers` (3), `--threshold` (0.5) -- BNW's own defaults from
+`sourcecodes/create_tiers_gom_part1.php`; `--ban`/`--white` for edge
+constraints; `--format json`; `--svg FILE` for a graphviz drawing;
+`--workdir DIR` and `--keep` to inspect a run.  Exit codes: 0 ok, 2 bad input,
+3 the computation failed, 77 the binaries are not installed.
+
+### Parity with the web application
+
+`test/parity_check.py` runs the driver on the six continuous traits of BNW's
+own 8-node example and compares against files the *web application* produced
+(the `test/golden/` fixtures, captured from the `bnw-container` on
+2026-11-12 by posting to `bn_genenet.php` and running `execute_bn_gom.php`):
+
+```
+ok   continuous_input.txt matches the web application's
+ok   structure_input.txt matches the web application's (5 edge(s))
+ok   stdout reports the same 5 edge(s)
+PARITY OK
+```
+
+That check is also how the input format was pinned down: `continuous_input.txt`
+is a header line of variable names, then a **type line** (1 = continuous, n =
+n-level discrete, one integer per variable), then the data.  The type line is
+not optional -- `network_score` reads it before the data -- and it is the
+reason the web application's copy has one more line than the matrix.
+
 ## Testing (HTTP functional tests)
 
 `test/bnw_http_tests.py` tests a *running* BNW instance over plain