@totemstan/man
v1.15.0
Published
matrix manipulator
Downloads
3
Readme
MAN
Extends MathJX with various AI/ML methods:
- light weight image processing
- symbolic algebra
- time series analysis ( digital signal, spectral)
- hidden markov methods ( viterbi, baum-welch, EM)
- matrix decompositions ( eigen spectrums)
- bayesian belief networks
- recurrent neural networks
- convolutional neural networks
- regression methods ( logistic, support vector, other)
- non-linear optimizers ( least cost path, linear programming, gradient descent, newton-raphton)
- neural networks ( convolutional, language models)
- special functions ( gamma, multivariate normal, rieman-zeta).
See the Program Reference for method details.
Usage
Acquire and optionally configure MAN as follows:
const $ = require("man").config({
key: value, // set key
"key.key": value, // indexed set
"key.key.": value // indexed append
});
where configuration keys follow ENUMS deep copy conventions
Manage
npm install @totemstan/enums # install
npm run start [ ? | $ | ...] # Unit test
npm run verminor # Roll minor version
npm run vermajor # Roll major version
npm run redoc # Regen documentation
Program Reference
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
| Param | Type | Description | | --- | --- | --- | | 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 => { // eval with callback
Trace("updated context", ctx);
} ),
ctx = "script".$( ctx ), // abbreviated
{ x, y, ... } = "script".$( ctx ) || {}; // with context x,y extractions
Example
### Create a matrix:
var
A = $( N, (n,A) => A[n] = ... ) , // define N-length vector
A = $( [M,N], (n,m,A) => A[m][n] = ... ) ; // define M x N matrrix
Example
### Index a matrix:
A.$( (n,A) => A[n] = ... ) // index vector with callback
A.$$( (n,m,A) => A[n][m] = ... ) // index matrix with callback
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", // array indicies
i: [0,1,2,3], // domain of index i
j: [4,8], // domain of index j
k: [0], // domain of index k
qos: 0, // regulation time in ms if not zero
local: false, // enable to run task local, i.e. w/o workers and nodes
workers: 4, // limit number of workers (aka cores) per node
nodes: 3 // limit number of nodes (ala locales) in the cluster
},
// here, a simple task that returns a message
$ => "my result is " + (i + j*k) + " from " + $.worker + " on " + $.node,
// here, a simple callback that displays the task results
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] = ... } )
$({ // import functions
f: (...) => { ... },
...
})
$({ // task sharding
keys: "i,j,...", // array indicies
i: [...], // domain of index i
j: [...], // domain of index j
k: [...], // domain of index k
qos: N, // regulation time in ms if not zero
local: false, // enable to run task local, i.e. w/o workers and nodes
workers: N, // limit number of workers (aka cores) per node
nodes: N // limit number of nodes (ala locales) in the cluster
},
// here, a simple task that returns a message
$ => "my result is " + (i + j*k) + " from " + $.worker + " on " + $.node,
// here, a simple callback that displays the task results
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", // array indicies
i: [0,1,2,3], // domain of index i
j: [4,8], // domain of index j
k: [0], // domain of index k
qos: 0, // regulation time in ms if not zero
local: false, // enable to run task local, i.e. w/o workers and nodes
workers: 4, // limit number of workers (aka cores) per node
nodes: 3 // limit number of nodes (ala locales) in the cluster
},
// here, a simple task that returns a message
$ => "my result is " + (i + j*k) + " from " + $.worker + " on " + $.node,
// here, a simple callback that displays the task results
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
Contacting, Contributing, Following
Feel free to
- submit and status TOTEM issues
- contribute to TOTEM notebooks
- revise TOTEM requirements
- browse TOTEM holdings
- or follow TOTEM milestones
License
© 2012 ACMESDS