import"github.com/goglue/bayesian"funcmain() {
// new structure of the classifierclassifier:=bayesian.New()
classes:= []string{"laptops", "computers"}
// add classes to the classifierclassifier.AddClasses(classes)
// - teach laptops classclassifier.Learn("laptops", "wifi")
classifier.Learn("laptops", "wifi")
classifier.Learn("laptops", "ram")
classifier.Learn("laptops", "hdd")
// - teach computers class (LearnBulk)comLearnings:= []string{"wifi", "monitor", "monitor", "ram", "hdd"}
classifier.LearnBulk("computers", comLearnings)
// setup is done, now get the scores of a given docsnodes:= []string{"wifi", "ram", "hdd"}
scores:=classifier.Probability(nodes)
/* scores : map[laptops:0.7575757575757576 computers:0.24242424242424246] */
}
Frequency table
You can implement this interface and set the classifier storage to it