Code Monkey home page Code Monkey logo

discretepredictors.jl's Introduction

DiscretePredictors

DiscretePredictors is a collection of algorithms for online discrete sequence prediction. It provides a common API to various discrete sequence prediction algorithms. My goals with the package are:

  • Simple Interface
  • Easily Extendable
  • Reproducible Research

Build Status Build Status Build status Documentation

Installation For Julia 1.0+

] add DiscretePredictors

Development of this package now targets only Julia 1.+. A release for Julia 0.6.x/0.7.0 can be downloaded from here.

API Overview:

  • p = Predictor{SymbolType}(parameters...) creates a predictor instance p with prediction algorithm Predictor (see choices below) of symbols of SymbolType with specified the parameters
  • add!( p, sym ) adds a symbol to the model
  • predict( p ) computes a probability distribution over the symbols seen so far by the model and returns it as dictionary of Dict{SymbolType,Float64}
  • info_string( p ) returns a human readable string about the predictor p
  • unique_string( p ) returns a unique string for the predictor p with parameter configuration
  • get_best_symbol( p ) returns the symbol of type SymbolType with highest probability under current context
  • size( p ) returns the number of nodes in current prediction model p.model

Available Predictors:

  • Adaptive MPP (AdaptiveMPP)
  • Active LeZi (ALZ)
  • Dependency Graph (DG)
  • Discounted HEDGE on KOM (dHedgePPM)
  • Error Weighted PPM (ewPPM)
  • K-th Order Markov Model (KOM)
  • LeZi-Update (LeZiUpdate)
  • LeZi78 (LeZi78)

Example

# Initialize a predictor
julia> p = KOM{Char}(4)
DiscretePredictors.KOM{Char}([*] (0)
, Char[], 4)
# Add some symbols
julia> add!( p, 'a' )
julia> add!( p, 'b' )
julia> add!( p, 'c' )
julia> add!( p, 'b' )
# Print out the model
julia> p
DiscretePredictors.KOM{Char}([*] (4)
+---[b] (2)
     +---[c] (1)
          +---[b] (1)
+---[a] (1)
     +---[b] (1)
          +---[c] (1)
               +---[b] (1)
+---[c] (1)
     +---[b] (1)
, ['a', 'b', 'c', 'b'], 4)
# Get prediction
julia> predict( p )
Dict{Char,Float64} with 3 entries:
  'b' => 0.25
  'a' => 0.125
  'c' => 0.625
# Get best symbol
julia> get_best_symbol( p )
'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase)
julia> info_string( p )
"KOM(4)"
julia> unique_string( p )
"KOM_04"
julia> size( p )
10

Contribute

You can contribute to this project in multiple ways:

  1. Found a bug? Please file an issue.
  2. Want to see a new predictor implemented? Please file an issue with relevant references. We will make our best effort to implement it.
  3. Implemented a new algorithm? Great! Go ahead and open a PR.

Acknowledgements

This package uses a modified version of trie from DataStructures.jl. I sincerely thank the developers of trie.jl.

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.