Documentation ¶
Overview ¶
Package bayesian implements a bayesian classifier
Index ¶
Constants ¶
View Source
const Negative = 0
Negative represents the negative category in a binary classifier
View Source
const Positive = 1
Positive represents the positive category in a binary classifier
Variables ¶
View Source
var ErrInvalidSmoothingFactor = errors.New("bayesian: invalid smoothing factor")
ErrInvalidSmoothingFactor is an error we throw when the smoothing factor provided is less than 0
Functions ¶
This section is empty.
Types ¶
type BinaryClassifier ¶
type BinaryClassifier interface { Scores(doc []string) ([]*big.Float, int, bool) LearnPositive(doc []string) error LearnNegative(doc []string) error }
BinaryClassifier is an interface to a simple bayesian binary classifier
func NewBinaryClassifier ¶
func NewBinaryClassifier(smoothingFactor float64) (BinaryClassifier, error)
NewBinaryClassifier creates a new bayesian classifier with two classes
type Classifier ¶
type Classifier interface { Scores(doc []string) ([]*big.Float, int, bool) Learn(doc []string, category int) error }
Classifier is an interface to a general multi-class bayesian classifier
func NewClassifier ¶
func NewClassifier(categories int, smoothingFactor float64) (Classifier, error)
NewClassifier creates a new instance of a bayesian with n classes classifier
Click to show internal directories.
Click to hide internal directories.