NaiveBayesClassifier.__init__(label_probdist, feature_probdist)[source]
  • label_probdist – P(label), the probability distribution over labels. It is expressed as a ProbDistI whose samples are labels. I.e., P(label) = label_probdist.prob(label).
  • feature_probdist – P(fname=fval|label), the probability distribution for feature values, given labels. It is expressed as a dictionary whose keys are (label, fname) pairs and whose values are ProbDistI objects over feature values. I.e., P(fname=fval|label) = feature_probdist[label,fname].prob(fval). If a given (label,fname) is not a key in feature_probdist, then it is assumed that the corresponding P(fname=fval|label) is 0 for all values of fval.