[experimental] Online (convex) learning in haskell over a nanomsg interface.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



EXPERIMENTAL: This is experimental, unpackaged, undocumented code.

Haskell Online Learning.

Online linear learning for regression, ranking.

The design is biased torwards usage as a server over a nanomsg socket, but it is possible to use the code offline on CSV files.

Use for dense input data, no feature hashing is used.

Currently implemented algorithms :
Stochastic Gradient Descent
Normalized Adaptive Gradient


####CLI Interface:

####Example for Preference Learning (a.k.a pairwise learning to rank)

  rank [--nanomsg] [--port=PORT] [--config=FILE] [-v]
  rank [--nanomsg] [--port=PORT] [--learningrate=LR] [--lambda=LAMBDA] [--dim=DIM] [--poly] [--algo=ALG] [-v]

  -h, --help           Show this screen.
  -v                   Verbose Mode.
  --config=FILE        Configuration file for the learning process.
  --nanomsg            Work as a prediction server using the nanomsg API.
  --port=PORT          Bind the nanomsg API to [default: 5099]
  --lambda=LAMBDA      SVM Hyperparameter [default: 1]
  --learningrate=LR    Learning Rate [default: 1]
  --dim=DIM            Model size [default: 2]
  --algo=ALG           Learning Algorithm among sgd,nag [default: sgd]
  --poly               Use polynomial features.

####Input/Output (for Ranking) There are two methods for using the learner:

  • stdin/stdout: Take input in space separated CSV format from stdin, Write output to stdout. The inputs are provided via stdin, possibly in a sequential fashion. The input format is the following:
    i x_1 x_2 .. x_n
    for i being a command integer and x_j being the j-th entry of the feature vector x of a data point. The command integer i indicates the operation to perform. The input format of the optimization program of the learning procedure is xlhs <= xrhs where the inequality denotes an increasing score.
  • Network: Take input as an array of IEEE 754 of little endian 32-bit floating point values written to a local PAIR Nanomsg socket. Write output to the same socket as a IEEE 754 little endian 32-bit float. The Python API gives an example of how to interact with the learner over a nanomsg socket.


i        corresponding action
0        rank the vector x
1        take x as x_rhs and wait lhs for vectors to build inequalities.
-1       take x as right hand constraint and await more right hand constraints.
other    do nothing

As an example, if vectors [1,2] and [2,3] have to be ranked higher than [0,1]:

1 0 1
-1 1 2
-1 2 3

####References Normalized Adaptive Gradient

  author    = {St{\'{e}}phane Ross and
               Paul Mineiro and
               John Langford},
  title     = {Normalized Online Learning},
  journal   = {CoRR},
  volume    = {abs/1305.6646},
  year      = {2013},
  url       = {http://arxiv.org/abs/1305.6646},
  timestamp = {Sun, 02 Jun 2013 20:48:21 +0200},
  biburl    = {http://dblp.uni-trier.de/rec/bib/journals/corr/abs-1305-6646},
  bibsource = {dblp computer science bibliography, http://dblp.org}

Generalized Online Mirror Descent

  author    = {Francesco Orabona and
               Koby Crammer and
               Nicol{\`{o}} Cesa{-}Bianchi},
  title     = {A Generalized Online Mirror Descent with Applications to Classification
               and Regression},
  journal   = {CoRR},
  volume    = {abs/1304.2994},
  year      = {2013},
  url       = {http://arxiv.org/abs/1304.2994},
  timestamp = {Thu, 02 May 2013 15:54:11 +0200},
  biburl    = {http://dblp.uni-trier.de/rec/bib/journals/corr/abs-1304-2994},
  bibsource = {dblp computer science bibliography, http://dblp.org}

Online Convex Programming and Generalized Infinitesimal Gradient Ascent

    author = {Martin Zinkevich},
    title = {Online Convex Programming and Generalized Infinitesimal Gradient Ascent},
    year = {2003}