Open uccmen opened 7 years ago
package main import ( "log" "github.com/jbrukh/bayesian" ) const ( Arabic bayesian.Class = "Arabic" Malay bayesian.Class = "Malay" Yiddish bayesian.Class = "Yiddish" ) func main() { nbClassifier := bayesian.NewClassifier(Arabic, Malay, Yiddish) arabicStuff := []string{"algeria", "bahrain", "comoros"} malaysianStuff := []string{"malaysians", "bahasa"} yiddishStuff := []string{"jewish", "jews", "israel"} nbClassifier.Learn(arabicStuff, Arabic) nbClassifier.Learn(malaysianStuff, Malay) nbClassifier.Learn(yiddishStuff, Yiddish) log.Println(nbClassifier.Learned()) // 3 log.Printf(`SEEN: %d`, nbClassifier.Seen()) // 0 }
Probably you already figured it out, but...
Seen() will increase only after you call one of the following methods:
Seen()
nbClassifier.LogScores(...) nbClassifier.ProbScores(...) nbClassifier.SafeProbScores(...)