npm.io
0.0.9 • Published 7 years ago

vowpal-turtle

Licence
ISC
Version
0.0.9
Deps
0
Size
13 kB
Vulns
0
Weekly
0

Table of Contents

readModel

index.js:70-117

it does not support quadratic/cubic interractions, ngrams/skips, linking functions rather than identity it basically only supports(for now) cat data | vw --readable_model out.txt [-oaa]

Parameters
  • file String vw --readable_file output
  • cb Function callback once the file is loaded, takes the loaded model as only argument

predict

index.js:147-160

makes a prediction from a request and a model the request is { namespaces: [{name: 'some_namespace', features: [{name: 'some_feature', value: 1}]}]}

Parameters
  • model Object mode loaded from @see readModel
  • request Object {.namespaces - array of namespaces, each of which has array of features}
Examples
var vw = require('vowpal-turtle')
vw.readModel('readable_model.txt', (model) => {
    var prediction = vw.predict(model, {
        namespaces: [{
            name: 'something',
            features: [{
                name: 'a',
                value: 1
            }, {
                name: 'b',
                value: 1
            }, {
                name: 'c',
                value: 1
            }]
        }]
    });
    console.log(prediction)
});

Returns Float32Array prediction, one prediction per class (depending on oaa, by default 1)

Keywords