code wiki / _hdl_build / nx_decision_tree_gate.nx
nx_decision_tree_gate.nx
buildroot/runtime/_hdl_build/nx_decision_tree_gate.nx
dependencies 4 imports · 0 importers
imports: nx_gate_gn.nxnx_gate_base.nxnx_f32_hw.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 18 | func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw(" calls 1: gw |
| 20 | func gm(x: i64) -> i64 { return gn(f32_int(f32_mul(x, f32_of(1000)))) } |
| 21 | func f32_le(x: i64, y: i64) -> i64 { let d: i64=f32_sub(x,y) & 0xFFFFFFFF; if ((d>>31)&1)==1 { return 1 } if (d & 0x7FFFFFFF)==0 { return 1 } return 0 } |
| 23 | func gini(n0: i64, n1: i64) -> i64 { let n: i64=n0+n1; if n==0 { return f32_of(0) } let p0: i64=f32_div(f32_of(n0),f32_of(n)); let p1: i64=f32_div(f32_of(n1),f32_of(n)); return f32_sub(f32_sub(f32_of(1),f32_mul(p0,p0)),f32_mul(p1,p1)) } |
| 25 | func split_gini(X1: *i64, X2: *i64, Y: *i64, N: i64, feat: i64, thr: i64) -> i64 |
| 34 | func tree_classify(x1: i64, x2: i64) -> i64 { if x1>5 { if x2>5 { return 1 } return 0 } return 0 } called by 1: main |
| 35 | func stump_classify(x1: i64) -> i64 { if x1>5 { return 1 } return 0 } // depth-1: right child majority=1 |
| 37 | func main() -> i64 |