You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting float division by zero while classifying #9
Hi,
these are the two commands I ran for training:
python bayes.py learn spam ../outspam.csv 500 //Processed 500 documents of type 'spam' python bayes.py learn fine ../outfine.csv 500 //Processed 500 documents of type 'fine'
And after this i tried this below classify command and get the 'float division by zero' error
python bayes.py classify ../testfine.csv spam fine
float division by zero
Thus I am unable to tell you exactly which line is causing this issue.
Traceback (most recent call last):
File "bayes.py", line 31, in <module>
mode.output(mode.execute())
File "/Users/nazimzeeshan/Sites/hacks/spam/bayesian-classifier/classify.py", line 91, in execute
result = self.p_from_list(pl)
File "/Users/nazimzeeshan/Sites/hacks/spam/bayesian-classifier/classify.py", line 74, in p_from_list
return p_product / (p_product + p_inverse_product)
ZeroDivisionError: float division by zero
Activity
codebox commentedon Jan 20, 2018
Please post the full error details, this will tell me which line of code caused the error.
nzee commentedon Jan 23, 2018
Hi,
these are the two commands I ran for training:
python bayes.py learn spam ../outspam.csv 500//Processed 500 documents of type 'spam'python bayes.py learn fine ../outfine.csv 500//Processed 500 documents of type 'fine'And after this i tried this below classify command and get the 'float division by zero' error
python bayes.py classify ../testfine.csv spam fineThus I am unable to tell you exactly which line is causing this issue.
codebox commentedon Jan 23, 2018
Please replace the statement 'print ex' in bayes.py with the word 'raise' - that should provide more information about the error
nzee commentedon Jan 24, 2018
This is the traceback I got