Skip to content

Commit

Permalink
Added Markdown to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrukh committed Nov 30, 2011
1 parent 3dbdff2 commit 098fdbd
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 36 deletions.
36 changes: 0 additions & 36 deletions README

This file was deleted.

62 changes: 62 additions & 0 deletions README.md
@@ -0,0 +1,62 @@
### Naive Bayesian Classification

Perform naive Bayesian classification into an arbitrary number of classes on sets of strings.

Copyright (c) 2011. Jake Brukhman. (jbrukh@gmail.com).
All rights reserved. See the LICENSE file for BSD-style
license.

------------

#### Background

See code comments for a refresher on naive Bayesian classifiers.

------------

#### Installation

To install, simply:

$ make install

To test, use:

$ make test

------------

#### Example

To use the classifier, first you must create some classes
and train it:

import . "bayesian"

const (
Good Class = "Good"
Bad Class = "Bad"
)

classifier := NewClassifier(Good, Bad)
goodStuff := []string{"tall", "rich", "handsome"}
badStuff := []string{"poor", "smelly", "ugly"}
classifier.Learn(goodStuff, Good)
classifier.Learn(badStuff, Bad)

Then you can ascertain the scores of each class and
the most likely class your data belongs to:

scores, likely, _ := classifier.Score(
[]string{"tall", "girl"}
)

Magnitude of the score indicates likelihood. Alternatively (but
with some risk of float underflow), you can obtain actual probabilities:


probs, likely, _ := classifier.Probabilities(
[]string{"tall", "girl"}
)

Use wisely.

0 comments on commit 098fdbd

Please sign in to comment.