See the Program Reference for method details.
Open/Close
## Modules
- String
- Array
- JIMP
- MAN
Add AI/ML methods to the MathJX.
This module documented in accordance with jsdoc.
String
String~$()
Kind: inner method of String
Array
Array~copy()
Kind: inner method of Array
Array~dist()
Kind: inner method of Array
Array~nearestOf()
Kind: inner method of Array
Array~batch()
Kind: inner method of Array
Array~flush()
Kind: inner method of Array
Array~draw()
Kind: inner method of Array
Array~match()
Kind: inner method of Array
Array~replace()
Kind: inner method of Array
Array~$(index, ctx) ⇒ Object
Index an array using a indexor:
string of the form "to=from & to=eval & to & ... & !where=eval"
hash of the form {to: from, ...}
callback of the form (idx,array) => { ... }
The "!where" clause returns only records having a nonzero eval.
Kind: inner method of Array
Returns: Object - Aggregated data
| index | String | Object | function | Indexer |
| ctx | Object | Context of functions etc |
Example
[{x:1,y:2},{x:10,y:20}].$("u=x+1&v=sin(y)&!where=x>5",Math)
{ u: [ 11 ], v: [ 0.9129452507276277 ] }
Example
[{x:1,y:2},{x:10,y:20}].$("x")
{ x: [ 1, 10 ] }
Example
[{x:1,y:2},{x:10,y:20}].$("x&mydata=y")
{ mydata: [ 2, 20 ], x: [ 1, 10 ] }
Example
[{x:1,y:2},{x:10,y:20}].$("mydata=[x,y]")
{ mydata: [ [ 1, 2 ], [ 10, 20 ] ] }
Example
[{x:1,y:2},{x:10,y:20}].$("mydata=x+1")
{ mydata: [ 2, 11 ] }
Example
[{x:1,y:2},{x:10,y:20}].$("",{"!all":1})
{ x: [ 1, 10 ], y: [ 2, 20 ] }
Example
[{x:1,y:2},{x:10,y:20}].$("")
[ { x: 1, y: 2 }, { x: 10, y: 20 } ]
Example
[{x:1,y:2},{x:10,y:20}].$("u")
{ u: [ undefined, undefined ] }
Example
[[1,2,3],[10,20,30]].$("1&0")
{ '0': [ 1, 10 ], '1': [ 2, 20 ] }
Array~$$()
Kind: inner method of Array
Array~unique()
Kind: inner method of Array
JIMP
JIMP~save()
Kind: inner method of JIMP
JIMP~sym()
Kind: inner method of JIMP
MAN
Add AI/ML methods to the MathJX.
This module documented in accordance with jsdoc.
Requires: module:enums, module:mathjx, module:crypto, module:mathjs, module:fft-js, module:nodehmm, module:node-svd, module:node-svm, module:mljs, module:jimp, module:jsbayes, module:recurrent-js, module:gamma, module:expectation-maximization, module:multivariate-normal, module:newton-raphson, module:random-seed, module:edmonds-blossom, module:simple-simplex, module:tensorflow/tfjs
Author: ACMESDS
Example
### Eval a js or mathjs script in a context ctx:
var
ctx = $( "script", ctx, ctx => {
Trace("updated context", ctx);
} ),
ctx = "script".$( ctx ),
{ x, y, ... } = "script".$( ctx ) || {};
Example
### Create a matrix:
var
A = $( N, (n,A) => A[n] = ... ) ,
A = $( [M,N], (n,m,A) => A[m][n] = ... ) ;
Example
### Index a matrix:
A.$( (n,A) => A[n] = ... )
A.$$( (n,m,A) => A[n][m] = ... )
Example
### Sample a matrix with optional callback cb(val):
var
B = A.get( idx , cb),
B = A.get( "key, ...", cb ),
B = A.get( [idx, ...] , cb),
B = A.get( [key, ...] , cb ),
B = A.get( {rekey: { toKey: "fromKey", ... }, cb ),
B = A.get( {draw: N}, cb ),
B = A.get( {start:N, count:N}, cb ),
B = A.get( {KEY_starts: "with", ...}, cb ),
B = A.get( {KEY_ends: "with", ...}, cb )
Example
### Import functions to $.somefn and to $( "somefn(...)" )
$( {
somefn: function (args) { ... },
:
:
} );
Example
### Use the task sharder:
$( {
keys: "i,j,k",
i: [0,1,2,3],
j: [4,8],
k: [0],
qos: 0,
local: false,
workers: 4,
nodes: 3
},
$ => "my result is " + (i + j*k) + " from " + $.worker + " on " + $.node,
msg => console.log(msg)
);
Example
### Aggregate and save events ev = {at: "KEY", ...} to ctx.Save_KEY with
callback cb(unsaved events)
[ev, ...].save( ctx, evs => { ... } );
"query".save( ctx, evs => { ... } );
Example
### Usage methods of $().
const $ = require("man")
$( "mathjs script", ctx, ctx => { ... } )
$( "mathjs script", ctx )
$( "mathjs script" )
$( [M,N], (m,n,A) => { A[m][n] = ... } )
$( N, (n,A) => { A[n] = ... } )
$({
f: (...) => { ... },
...
})
$({
keys: "i,j,...",
i: [...],
j: [...],
k: [...],
qos: N,
local: false,
workers: N,
nodes: N
},
$ => "my result is " + (i + j*k) + " from " + $.worker + " on " + $.node,
msg => console.log(msg)
);
Example
### Eval a mathjs script with optional callback and optional context:
var
ctx = $( "mathjs script", ctx, ctx => {
x: 1,
y: 20, ...
} );
Example
### Eval with extraction of context keys:
const {x, y, ... } = $( "mathjs script", ctx ) || {};
Example
### import functions to $.somefn and to $( "somefn(...)" )
$( {
somefn: function (args) { ... },
:
:
} );
Example
### Use the task sharder:
$( {
keys: "i,j,k",
i: [0,1,2,3],
j: [4,8],
k: [0],
qos: 0,
local: false,
workers: 4,
nodes: 3
},
$ => "my result is " + (i + j*k) + " from " + $.worker + " on " + $.node,
msg => console.log(msg)
);
MAN~scripts
Kind: inner property of MAN
scripts.conf
Kind: static property of scripts
scripts.pca
Kind: static property of scripts
scripts.roc
Kind: static property of scripts
scripts.snr
Kind: static property of scripts
scripts.p0
Kind: static property of scripts
scripts.pw
Kind: static property of scripts
scripts.wk
Kind: static property of scripts
scripts.trigger()
Kind: static method of scripts