Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed divided by zero warning #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nimasdj
Copy link

@nimasdj nimasdj commented Aug 29, 2016

See #5
Avoid divided by zero warning if some probabilities are zero.

Avoid divided by zero warning if some probabilities are zero.
@@ -16,8 +16,10 @@ protected function bayes(array $lexemes)
$numerator = 1;
$denominator = 1;
foreach ($lexemes as $lexeme) {
$numerator *= $lexeme['probability'];
$denominator *= 1 - $lexeme['probability'];
if ($lexeme['probability'] > 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we put this here we make that selected lexeme will not be used in calculating (so we lost important information) and we don't want it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. What was the problem that was happening?

@bgruszka bgruszka added the bug label Sep 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants