code wiki / (root) / nx_fin_pbo.nx

nx_fin_pbo.nx

buildroot/runtime/nx_fin_pbo.nx

2604 B48 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic fin
docsdependenciesstructsconstsfunctions

about

nx_fin_pbo.nx -- Probability of Backtest Overfitting (Bailey/Lopez de Prado CSCV). Completes the overfit- detection suite (deflated-Sharpe was the multiple-testing correction; PBO is the combinatorial one). Given an M-strategy x S-group performance matrix, enumerate every C(S, S/2) train/test split (train = set bits of a popcount-S/2 mask, test = the rest); for each split pick the BEST in-sample strategy and ask whether it lands in the BOTTOM HALF out-of-sample. PBO = fraction of splits where it does. High PBO => your "winner" is likely luck. Pure integer combinatorics -- no transcendental functions, exact + gate-checkable. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_fin_pbo.nx nx_fin_pbo_gate.nx

imports: nx_syscalls.nx

imported by: nx_fin_pbo_gate.nx

structs

none

consts

8const K_MAGIC_1000000000: i64 = 1000000000

functions

10func pb_popcount(x: i64) -> i64 { var c: i64 = 0; var v: i64 = x; while v > 0 { c = c + (v & 1); v = v >> 1 } return c }
called by 2: pb_pbo_permillemain
13func pb_pbo_permille(perf: *i64, m: i64, s: i64) -> i64
called by 1: main calls 2: pb_popcountsys_mmap
48func pb_overfit_likely(pbo_permille: i64, thresh_permille: i64) -> i64 { if pbo_permille >= thresh_permille { return 1 } return 0 }
called by 1: main