Documentation ¶
Index ¶
- type NaiveBayesClassifier
- func (c *NaiveBayesClassifier) Classify(document string) (category string)
- func (c *NaiveBayesClassifier) Evaluate(train, test []mlutils.LabeledDocument)
- func (c *NaiveBayesClassifier) Fit(data map[string][]string)
- func (c *NaiveBayesClassifier) Probabilities(document string) (p map[string]float64)
- func (c *NaiveBayesClassifier) SaveClassifierToFile(path string) error
- type Sorted
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NaiveBayesClassifier ¶
type NaiveBayesClassifier struct { Words map[string]map[string]int TotalWords int CategoriesDocuments map[string]int TotalDocuments int CategoriesWords map[string]int Threshold float64 }
NaiveBayesClassifier is what we use to classify documents
func NewClassifierFromFile ¶
func NewClassifierFromFile(path string) (*NaiveBayesClassifier, error)
create and initialize the classifier from a file
func NewClassifierFromFileData ¶
func NewClassifierFromFileData(data []byte) (*NaiveBayesClassifier, error)
create and initialize the classifier from a file data
func NewClassifierWithReader ¶
func NewClassifierWithReader(reader io.Reader) (*NaiveBayesClassifier, error)
create and initialize the classifier from a file data
func (*NaiveBayesClassifier) Classify ¶
func (c *NaiveBayesClassifier) Classify(document string) (category string)
Classify a document
func (*NaiveBayesClassifier) Evaluate ¶
func (c *NaiveBayesClassifier) Evaluate(train, test []mlutils.LabeledDocument)
func (*NaiveBayesClassifier) Fit ¶
func (c *NaiveBayesClassifier) Fit(data map[string][]string)
func (*NaiveBayesClassifier) Probabilities ¶
func (c *NaiveBayesClassifier) Probabilities(document string) (p map[string]float64)
Probabilities of each category
func (*NaiveBayesClassifier) SaveClassifierToFile ¶
func (c *NaiveBayesClassifier) SaveClassifierToFile(path string) error
save the classifier to a file
Click to show internal directories.
Click to hide internal directories.