Giter Site home page Giter Site logo

vw-stream's Introduction

vw-stream

Online machine learning with Vowpal Wabbit as Node.js streams.

Features

  • Stream Abstraction: Treat a Vowpal Wabbit learner process as a writable & readable stream. You write training or testing examples, and read predictions from the stream.
  • Sparse Example Format: Represent your training or testing examples and observations naturally, as sparse JavaScript objects.
  • Namespace Mapping: Use descriptive feature namespace names, which are mapped under-the-hood onto Vowpal Wabbit's preferred single-character namespace codes.
  • Live Model Persistence: Retrieve the Vowpal Wabbit binary model ("regressor") during training or testing. You never need to shut-down the Vowpal Wabbit process!
  • Child, Not Daemon: Uses a spawned child process for Vowpal Wabbit, for simpler interaction and IPC management.

Example

From the Vowpal Wabbit tutorial:

var vw = new VowpalWabbitStream({ learningRate: 10 });
vw.on('data', function(obj) {
    console.log("Prediction & Average Loss:", obj.ex, obj.pred, vw.getAverageLoss());
});
var exs = [
    { resp: 0, featMap: { price: 0.23, sqft: 0.25, age: 0.05, yr2006: 1.0 } },
    { resp: 1, imp: 2.0, featMap: { price: 0.18, sqft: 0.15, age: 0.35, yr1976: 1.0 } },
    { resp: 0, initPred: 0.5, featMap: { price: 0.53, sqft: 0.32, age: 0.87, yr1924: 1.0 } }
];
for (var pass=0; pass < 25; pass++) {
    for (var i=0; i < exs.length; i++) {
        vw.write(exs[i]);
    }
}
vw.end();
/*
[20150604@15:30:24.893] DEBUG -- VW(STDERR): finished run
[20150604@15:30:24.893] DEBUG -- VW(STDERR): number of examples per pass = 75
...
[20150604@15:30:24.894] DEBUG -- VW(STDERR): average loss = 0.057188
*/

Shout-outs

vw-stream's People

Contributors

someben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mindis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.