GithubHelp home page GithubHelp logo

rlugojr / decider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danielsdeleo/decider

0.0 2.0 0.0 25.04 MB

Flexible and Extensible Machine Learning in Ruby

License: MIT License

Ruby 98.12% Gherkin 1.88%

decider's Introduction

Decider

Yet Another Ruby Machine Learning Library

Manifesto

There are other ruby machine learning libraries out there:

So why another one?

  • You can install it and try it in irb right away. You don’t need to learn how a half-dozen classes work to get started:

    c = Decider.classifier(:spam, :ham)
    c.spam << "some spammy text"
    c.ham << "some hammy goodness"
    c.spam?("more spammy text")
    # => true
    

The default configuration is about 96% accurate as an email spam classifier.

  • You can control how it processes its input easily. Decider has built-in support for plain text and URIs, stemming words, stop word removal, and n-grams. All of these can easily be combined at your option (see “Getting Started” below for a quick example). Additional tokenization strategies or support for non-text document types can be added with a minimum of hassle.

  • Persist (Save) with Moneta. Pretty much any storage mechanism that’s available in ruby is supported. Save to a database and implement distributed classification if you like.

  • Clustering Analysis. Useful for recommendation algorithms. (In Progress)

Getting Started

c = Decider.classifier(:spam, :ham) do |doc|
  doc.plain_text
  doc.ngrams(2..3)
  doc.stem
end

c.spam << "buy viagra, jerk" << "get enormous hot dog for make women happy"
c.ham << "check out my code on github homie" << "let's go out for beers after work"

p c.spam?("viagra for huge hot dog")
# => true
puts "term frequencies:"
puts "spam: #{c.spam.term_frequency.inspect}"
puts "ham:  #{c.ham.term_frequency.inspect}"
puts ""
p c.scores("let's write code and drink some beers")
# => {:spam=>0.0, :ham=>1.0}
p c.classify("let's write code and drink some beers")
# => :ham

Performance

Decider has several benchmarks that also double as integration tests. These are run regularly and used to pinpoint CPU and RAM bottlenecks.

Decider does a lot of math and is fairly computationally intensive, so you want all the extra speed you can get. It is regularly tested with Ruby 1.9 and Jruby. I highly recommend using one of these Ruby implementations if at all possible if you plan on doing anything serious with Decider.

Also keep in mind that your dataset should reside entirely in memory or else you’ll hit a brick wall.

decider's People

Contributors

danielsdeleo avatar

Watchers

Ray Lugo, Jr. avatar  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.