Changeset 4665:78e74669830f in orange


Ignore:
Timestamp:
05/19/08 00:35:54 (6 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
1d61dd537c4b4864fc92f9aee5707d8e5f6865e8
Message:
  • fixed the problem with using uniform priors for attribute values which do not appear in the data in function TBayesClassifier::p, too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/bayes.cpp

    r4652 r4665  
    286286  for ( ; dciOK && (dci!=dce) || ceiOK && (cei!=cee); ei++) { 
    287287    if (!(*ei).isSpecial()) { 
    288       if (dciOK && *dci) 
    289         res *= (*dci)->p(*ei)->p(classValue)/c; 
     288      if (dciOK && *dci) { 
     289        PDistribution cp = (*dci)->p(*ei); 
     290        if (cp->cases > 1e-6) { 
     291          res *= (*dci)->p(*ei)->p(classValue)/c; 
     292        } 
     293      } 
    290294      else if (ceiOK && *cei)  
    291295        res *= (*cei)->call(classValue, *ei)/c; 
Note: See TracChangeset for help on using the changeset viewer.