cdipaolo/goml

Concurrent map access during NaiveBayes's OnlineLearning sequence

Closed this issue · 0 comments

In theOnlineLearn method, Words are written to the model's counts of words while the Predict, Probability, and TFIDF.InverseDocumentFrequency methods read from that same map. The only indication that training is done is that the errors channel passed in to OnlineLearn is closed, at which point it's safe to use the model. Otherwise, a runtime error will occur as a result of the concurrent map reads and writes.