Giter VIP home page Giter VIP logo

turtle's Introduction

# turtle - load readable_model from vowpal wabbit and serve it from java

## example train a model

$ vw -d /path/to/dataset/dataset --readable_model readable_model.txt

##  readable_model.txt looks like:
...
6163:0.0624969
7472:-0.12023
42847:-0.0421919
49960:-0.12023
51692:0.0624969
55432:-0.0421919
...

using https://gist.github.com/luoq/b4c374b5cbabe3ae76ffacdac22750af,
and some logic to produce the same buckets for the same feature combinations

## java code
add the dependency in pom.xml
<dependency>
    <groupId>bz.turtle</groupId>
    <artifactId>readable</artifactId>
    <version>2.0.4-BETA</version>
</dependency>

import bz.turtle.readable.*;

ReadableModel m = new ReadableModel("directory/of/readable_model.txt"); // .txt.gz also works


// this will load the model creating only float[] array with same size as 2**bits(-b from vw)
// it uses same algorithm to compute hash buckets as vw and then returns the inner product

m.predict(
          new Doc(
              new Namespace(
                  "your-namespace",
                  new Feature("a",1.0),
                  new Feature("b",1.0),
                  new Feature("c",1.0))));
// value 1.0 is default

## make sure it works
if you want to make sure your parameters are supported, in the repeatable_model.txt
add test.txt and predictions.txt (using -p from vw) and it will automatically
test if turtle gets the same predictions as the wabbit.

if you pass file to ReadableModel it will just try to load the file


check out resources/test for more examples


## known bugs

* -q ::
  the way vw does permutation is different, and it produces different results

## thanks

* Lucas Bernardi
* Tarek Sheasha
* Denis Bilenko

wouldn't have happened without the help of those guys

## todo

* more tests
* verify the checksum of the model
* support for --cubic
* support for ngrams and skips
* support for --lrq

turtle's People

Contributors

fbarrios avatar jackdoe avatar lucjb avatar

Watchers

 avatar

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.