class MultinomialNBClassifier implements ClassifierInterface
Use a multinomia NB model to classify a document
Methods
__construct(FeatureFactoryInterface $ff, MultinomialNBModelInterface $m) | ||
string |
classify(array $classes, DocumentInterface $d)
Compute the probability of $d belonging to each class successively and return that class that has the maximum probability. |
|
float |
getScore(string $class, DocumentInterface $d)
Compute the log of the probability of the Document $d belonging to class $class. |
Details
at line 19
public
__construct(FeatureFactoryInterface $ff, MultinomialNBModelInterface $m)
at line 34
public string
classify(array $classes, DocumentInterface $d)
Compute the probability of $d belonging to each class successively and return that class that has the maximum probability.
at line 61
public float
getScore(string $class, DocumentInterface $d)
Compute the log of the probability of the Document $d belonging to class $class.
We compute the log so that we can sum over the
logarithms instead of multiplying each probability.