Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented sparse observations and configurable additive smoothing. #2

Merged
merged 1 commit into from Dec 2, 2012

Conversation

@DrDub
Copy link
Contributor

DrDub commented Dec 2, 2012

(these are the first modifications being sent upstream from the urlclassy 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).
* 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 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).
@chrisumbel
Copy link
Member

chrisumbel commented Dec 2, 2012

Sweet. Thank you, sir!

chrisumbel added a commit that referenced this pull request Dec 2, 2012
Implemented sparse observations and configurable additive smoothing.
@chrisumbel chrisumbel merged commit ad2090e into NaturalNode:master Dec 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.