MCPcopy Index your code
hub / github.com/clips/pattern / __init__

Method __init__

pattern/vector/__init__.py:1970–1980  ·  view source on GitHub ↗

Naive Bayes is a simple supervised learning method for text classification. Documents are classified based on the probability that a feature occurs in a class, (independent of other features).

(self, train=[], baseline=FREQUENCY, method=MULTINOMIAL, alpha=0.0001)

Source from the content-addressed store, hash-verified

1968class NaiveBayes(Classifier):
1969
1970 def __init__(self, train=[], baseline=FREQUENCY, method=MULTINOMIAL, alpha=0.0001):
1971 """ Naive Bayes is a simple supervised learning method for text classification.
1972 Documents are classified based on the probability that a feature occurs in a class,
1973 (independent of other features).
1974 """
1975 self._classes = {} # {class: frequency}
1976 self._features = {} # {feature: frequency}
1977 self._likelihood = {} # {class: {feature: frequency}}
1978 self._method = method # MULTINOMIAL or BERNOUILLI.
1979 self._alpha = alpha # Smoothing.
1980 Classifier.__init__(self, train, baseline)
1981
1982 @property
1983 def method(self):

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected