sightmachine/SimpleCV

Naive Bayes Verbose

Closed this issue · 1 comments

When setting the naive bayes classifier verbosity to true, I get the following failure

 ERROR: 
 Traceback (most recent call last):
   File "classify.py", line 96, in <module>
     main()
   File "classify.py", line 79, in main
     trainer.train()
   File "classify.py", line 56, in train
     classifier.train(self.trainPaths,self.classes,verbose=True, savedata="train_results_" + str(count) + ".txt")
    File "/usr/local/lib/python2.7/dist-packages/SimpleCV/MachineLearning/NaiveBayesClassifier.py", line 240, in train
     for className, classConfusions in zip(classes, confusion):

I suspect that a simple check in that section to ensure confusion is in fact a number may make sense. However the "bug" may be higher up the food chain.

Update: Additional Details, I copied the implementation locally, and checked whether the item was a number, and it was, however it was 0, so when it tried to zip I can only assume (haven't verified yet is why assumed) that it's because you can't iterate through numbers when the number is 0.... so I'm testing out if confusion > 0: to see if it works.

Update again: if confusion > 0: did work, not sure if that's the right fix, but I figure it's more information :)
Have a great day.

I put a pull request in, if this repo is still accepting them. If not I have fixed it at https://github.com/onaclovtech/SImpleCV