node package manager


oryql adaptive structures


oryql adaptive structures are written in pure javascript and have no dependencies


for nodejs:

npm install oryql

or for a webpage:

<script src=""></script>



var labeller = oryql.label();
labeller.learn("string", ["string", ...]);
labeller.learn("string", ["string", ...], featurize); // advanced usage 
labeller.label("string", featurize);                  // advanced usage 

create a labeller:

var spam_filter = require('oryql').label();

or for a webpage:

var spam_filter = oryql.label();

teach the labeller by providing a content string as the first parameter, then an array of label strings as the second parameter - memory is the only limitation on content size and number of labels:

spam_filter.learn('getchyoself a bigga prick mate!', ['spam', 'adult']);
spam_filter.learn('get m3dz! h3r3!',                 ['spam', 'pharmacy']);

once the labeller has been sufficiently trained it can be used to label new content strings:

console.log(spam_filter.label('m3dz free!')); 

the resulting output is an array of labels and their scores, sorted most to least likely - an activation function is deliberatly ommited to allow activation via neural network, genetics, or other classifier:

[ {"label": "pharmacy", "score": 2}, 
  {"label": "spam",     "score": 1}, 
  {"label": "adult",    "score": 0} ]

more advanced users may also want to provide their own featurizing function, which can be done by creating a function then passing it as the last parameter to learn() and label():

var featurize = function (string) {
    // this function should take a content string and 
    // return an array of feature strings 
    // ie: "my dog skip" -> ["my", "dog", "skip"] 
    return ["string", ...];
labeller.learn("string", ["string", ...], featurize);
labeller.label("string", featurize);



var locals = oryql.locals();
locals.learn([420.00, ...], pocket);
locals.find([420.00, ...]);

create a vector space:

var ocr = require('oryql').locals();

or for a webpage:

var ocr = oryql.locals();

fill the vector space by providing fixed-n-dimensional vectors as the locator, along with a pocket of any type that is returned when finding locals:

ocr.learn([5, 4, 5, 5], 'a');
ocr.learn([0, 1, 1, 1], 'b');

once the vector space has been sufficiently filled it can be used to find locals:

console.log(ocr.find([0, 0, 1, 1]));

the resulting output is an array of all pockets and their distances sorted closest to farthest - an activation function is deliberatly ommited to allow activation via neural network, genetics, or other classifier:

[ { "distance": 1,  "pocket": "b" }, 
  { "distance": 17, "pocket": "a" } ]


path is still experimental

// create a path learner 
var path_learner = path();
// perform a training run, by providing the state hash and choices from that state 
path_learner.explore('A', ['forward', 'backward']);
path_learner.explore('B', ['forward', 'backward']);
// upon completion of training run, provide feedback, repeat until stable;
// get optimal choice using perfom, use the same way you would explore 
path_learner.perform('A', ['forward', 'backward']);
// upon completion of performance run, provide feedback;