One ring to rule them all. Classify, regress, cluster, anomaly,
sample/synth all = one engine + a (y_fn, reducer) pick.
Apps add no logic.
- ,Preci0us.md -- this landing page (design spine)
- ideas.md -- long-form primitives + app reductions
Sparsity of Influence. Median intrinsic dim <=5 in >=80% of MOOT tasks; top-5 vars carry 80% of y-variance. BINGO: discretize those few dims into a few buckets, capture y-variation. Data already clumped. Engine = find clumps, read them off. Divide cheap, tally cheap, explain-by-neighbor free.
Atom = num | str | nil
Row = Atom+
Col = Num | Sym
Num = (at, txt, n, mu, m2, lo, hi)
Sym = (at, txt, n, has)
Cols = (all, x, y)
Data = (rows, cols)
Cut = (col, val)
Node = (data, cut?, left?, right?)
Forest = Node+
5 shapes of substance: Col(Num|Sym), Data, Cut, Node, Forest.
engine(d, y_fn, reducer)
= tree(d, y_fn) >> relevant(row) >> reducer(leaf)
Whole library. Rest = pick y_fn, pick reducer, post-process.
* = paid (queries y-label). Else free.
Active learning = minimize starred calls. All else ~0 cost.
| paid | why |
|---|---|
add on y-col |
needs label |
cuts, tree, forest |
call y_fn |
peeks |
bounded label budget |
1. ctors Num.new Sym.new head
2. tally Num.add* Sym.add* Num.sub Sym.sub
3. col lemmas mid spread norm like cut
4. geometry distx disty near far anchors
5. data/io Data.new csv clone
6. splits divides cuts* Cut.new
7. cluster algebra group select describe contrast
8. structure Node.new tree* relevant Forest.new forest*
9. readouts vote mean density likely
10. acquisition random diverse smote kpp peeks*
| app | y_fn | reducer |
|---|---|---|
| ctree | klass | mode |
| rtree | disty | mean |
| lnn-c | row id (depth-1) | mode of k |
| lnn-r | row id | mean of k |
| layes | klass | argmax like |
| lmeans | distx-to-centroid | centroid |
| lnomaly | none | 1/density |
| fastmap | distx(a)-distx(b) | identity |
| ftree | distx(a)-distx(b) | mode/mean |
| peeks | disty + budget | mean |
| cell | reduction |
|---|---|
| Discover | group + describe |
| Predict | tree + relevant + reducer |
| Explain | contrast(mine, nearest-diff-y) |
| Trust | forest agreement (Rashomon |B|) |
| rung | this stack |
|---|---|
| 1 Association | near like describe regress/classify |
| 2 Intervention | contrast = min x-change flipping y |
| 3 Counterfactual | extrapolate/simulate, only inside |B| hull |
Stops at 2.5: no fantasy do-ops outside observed data.
| delete/move | LOC | why |
|---|---|---|
5 stub app files -> 1 apps.lua table |
-160 | each = 2-tuple over engine |
ftree/poles/sampleCap |
-40 | ftree = tree w/ anchor-proj y_fn |
attachD/_cache/d.x/d.y -> memo(fn) |
-25 | shape stays (rows, cols) |
klass/goal slots |
-5 | derive from header suffix |
Num.bin/Sym.bin |
-10 | floor(bins*norm) inline |
Confuse+stat tests -> eval.lua |
-80 | orthogonal, outside grammar |
~1313 LOC -> ~540 LOC (~60% cut). End state:
lib (helpers) + lull (engine + algebra) + apps (10-row
table) + eval (metrics, off to the side).
L4 algebra missing: group select describe contrast
(~40 LOC). Then layes lmeans explain trends forecast
collapse to one-liners.