bayesian

package module
v0.0.0-...-7b6f070 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2018 License: MIT Imports: 4 Imported by: 0

README

bayesian

A simple, efficient binary bayesian classification library

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

Directories

Path Synopsis
internal
radix
Package radix implements a radix tree for storing a collection of strings processing
Package radix implements a radix tree for storing a collection of strings processing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL