NaturalNode/apparatus — pull request #2 by DrDub (2012-12-02 05:46:46+00:00)
Title: Implemented sparse observations and configurable additive smoothing.

(these are the first modifications being sent upstream from the [urlclassy](https://github.com/DrDub/urlcassy) project.
A Chi-square-based feature selection should be coming soon, too.)

Changes:

* Observations can now be an arbitrary object. All values are expected
to be integers as index in the overall feature vector. The indices that
appear as values in the observation object are the entries set to 1 in
the non-sparse entries.

Compare:

nb.addExample([0,0,0,1,0,0,1],'good')
nb.addExample({'alpha':3, 'beta':6}, 'good')

both lines are now equivalent. The keys themselves are ignored, that is the
above line is equivalent to

nb.addExample({'x':3,'y':6}, 'good')

* There is a new argument in the constructor for the smoothing. If missing
it defaults to 1.0 (the previous value).