Orange Forum • View topic - Naive bayes crashes

Naive bayes crashes

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

Naive bayes crashes

Postby arauzo » Wed Jun 21, 2006 18:27

Naive Bayes crashes with this exception in some particular circumstances.

Code: Select all
File ".../orngTest.py", line 365, in testWithIndices
    cr = classifiers[cl](ex, orange.GetBoth)
orange.KernelException: 'orange.DiscDistribution': division by zero in /=


The following example code makes BayesLearner crash.

Code: Select all
import orange, orngTest, orngStat

learner = orange.BayesLearner()
data = orange.ExampleTable("audiology.tab")

# When this features are selected it fails
data = data.select(['age_gt_60', 'history_noise', 'tymp', 'history_fluctuating', 'history_nausea', 'history_ringing', 'history_heredity', 'airBoneGap', 'wave_V_delayed', 'history_buzzing'] + [data.domain.classVar.name])

# Ten fold cross-validadtion
selection = orange.MakeRandomIndicesCV(data, folds=10)

for test_fold in range(10):
       train_data = data.select(selection, test_fold, negate=1)
       test_data = data.select(selection, test_fold)
 
       # Inside training cross-validation
       # (used for example in Wrapper approach to feature selection)
       results = orngTest.crossValidation([learner], train_data, folds=10)
       print orngStat.CA(results)[0]

Postby Janez » Thu Jun 22, 2006 11:26

Code: Select all
# When this features are selected it fails
data = data.select(['age_gt_60', 'history_noise', 'tymp', 'history_fluctuating', 'history_nausea', 'history_ringing', 'history_heredity', 'airBoneGap', 'wave_V_delayed', 'history_buzzing'] + [data.domain.classVar.name])


And you are still using exactly these features?! Why!? Is annoying me really such a fun?

Kidding. Thanks for the detailed report, which was easy to reproduce. The "particular circumstances" occur if there is an empty class, and there is an attribute value which only appears in the test data, but not in the training data.

I fixed that; it's on CVS and will be in the tomorrow's snapshot.

Postby arauzo » Thu Jun 22, 2006 13:36

Hi Janez,

And you are still using exactly these features?! Why!? Is annoying me really such a fun?


We are running intensive experiments on feature selection. On smaller datasets, we have tried all combinations of features. We haven't tried all in audiology (2^69), but quite a few, being that particular feature set among them. ;-)

Thanks a lot for quick fixing.


Return to Bugs



cron