Tree learner via recursive random projections
| What | Notes |
|---|---|
XY:new(s:str, n:num, nlo:num, nhi:num) ⇒ XY |
count the y values from xlo to xhi |
| XY:__tostring() ⇒ str | |
XY:add(nx:num, sy:str, n:num?) ⇒ nil |
n[=1] times,count sy. Expand to cover nx |
XY:merge(xy:XY) ⇒ XY |
combine two items (assumes both from same column) |
XY:simpler(xy:XY, nMin:num) ⇒ XY |
if whole simpler than parts, return merged self+xy |
SYM:discretize(s:str) ⇒ s |
discretizing a symbol just returns that symbol |
NUM:discretize(n:num) ⇒ num |
discretize Nums,rounded to (hi-lo)/bins |
| DATA:better(row1, row2) ⇒ bool | returns true if row1's goals better than row2 |
| DATA:clone( init?) ⇒ data | return a table with the same structure |
Some general LUA functions. (c)2022 Tim Menzies timm@ieee.org BSD-2 license
| What | Notes |
|---|---|
| it.rogues() ⇒ nil | report rogue locals |
The LUA doco says its random number generator is not stable across platforms. Hence, we use our own (using Park-Miller).
| What | Notes |
|---|---|
it.srand(n:num) ⇒ nil |
reset random number seed (defaults to 937162211) |
it.rand(nlo:num, nhi:num) ⇒ num |
return float from nlo..nhi (default 0..1) |
it.rint(nlo:num, nhi:num) ⇒ int |
returns integer from nlo..nhi (default 0..1) |
| What | Notes |
|---|---|
it.any(t:tab) ⇒ any |
return any item from t, picked at random |
it.many(t:tab, n:num) ⇒ t |
return n items from t, picked at random |
it.per(t:tab, p) ⇒ num |
return the pth(=.5) item of sorted list t |
it.ent(t:tab) ⇒ num |
entropy |
it.kap(t:tab, fun:fun) ⇒ t |
map function fun(k,v) over list (skip nil results) |
it.keys(t:tab) ⇒ t |
sort+return t's keys (ignore things with leading _) |
it.map(t:tab, fun:fun) ⇒ t |
map function fun(v) over list (skip nil results) |
it.push(t:tab, x) ⇒ any |
push x to end of list; return x |
it.sd(t:tab) ⇒ num |
sorted list standard deviation= (90-10)th percentile/2.58 |
it.slice(t:tab, go, stop:str, inc) ⇒ t |
return t from go(=1) to stop(=#t), by inc(=1) |
| What | Notes |
|---|---|
it.gt(s:str) ⇒ fun |
return a function that sorts ascending on `s'. |
it.lt(s:str) ⇒ fun |
return a function that sorts descending on s. |
it.sort(t:tab, fun:fun) ⇒ t |
return t, sorted by fun (default= <) |
| What | Notes |
|---|---|
it.coerce(s:str) ⇒ any |
return int or float or bool or string from s |
it.options(s:str) ⇒ t |
parse help string to extract a table of options |
it.csv(sFilename:str, fun:fun) ⇒ nil |
call fun on rows (after coercing cell text) |
| What | Notes |
|---|---|
it.fmt(sControl:str, ...) ⇒ str |
emulate printf |
it.oo(t:tab) ⇒ nil |
print t's string (the one generated by o) |
it.o(t:tab, seen:str?) ⇒ str |
table to string (recursive) |
| What | Notes |
|---|---|
it.obj(s:str) ⇒ t |
create a klass and a constructor + print method |
Test suite support
| What | Notes |
|---|---|
it.cli(t:tab) ⇒ t |
alters contents of options in t from the command-line |
it.run(funs:[fun], t:tab) ⇒ nfails |
runs all funs (or t.go), resetting options & seed before each |
That's all folks.