Skip to content

Commit

Permalink
Merge pull request #24 from GopherML/fix/properly-complete-unfinished…
Browse files Browse the repository at this point in the history
…-comment-line

fix comment around logarithmic addition of probability values
  • Loading branch information
itsmontoya authored Aug 12, 2024
2 parents 9634755 + d53ad28 commit c01742d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bag.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (b *Bag) getProbability(ns []string, label string, vocab Vocabulary) (proba
// Utilize Laplace smoothing to improve our results when an ngram isn't found within the trained dataset
// Likelihood with Laplace smoothing
count := float64(vocab[n]) + b.c.SmoothingParameter
// Add logarithmic result of count (plus )
// Add logarithmic result of count divided by counts by label
probability += math.Log(count / countsByLabel)
}

Expand Down

0 comments on commit c01742d

Please sign in to comment.