\Camspiers\StatisticalClassifier\ClassifierComplementNaiveBayes

An implementation of a Naive Bayes classifier.

This classifier is based off Tackling the Poor Assumptions of Naive Bayes Text Classifiers by Jason Rennie

Summary

Methods
Properties
Constants
__construct()
prepareModel()
classify()
is()
setModel()
setDataSource()
No public properties found
No constants found
preparedModel()
applyTransform()
$tokenizer
$normalizer
$dataSource
$model
N/A
No private methods found
No private properties found
N/A

Properties

Methods

__construct()

__construct(\Camspiers\StatisticalClassifier\DataSource\DataSourceInterface $dataSource, \Camspiers\StatisticalClassifier\Model\ModelInterface $model, \Camspiers\StatisticalClassifier\Tokenizer\TokenizerInterface $tokenizer, \Camspiers\StatisticalClassifier\Normalizer\NormalizerInterface $normalizer)

Create the Naive Bayes Classifier

Parameters

\Camspiers\StatisticalClassifier\DataSource\DataSourceInterface $dataSource
\Camspiers\StatisticalClassifier\Model\ModelInterface $model

An model to store data in

\Camspiers\StatisticalClassifier\Tokenizer\TokenizerInterface $tokenizer

The tokenizer to break up the documents

\Camspiers\StatisticalClassifier\Normalizer\NormalizerInterface $normalizer

The normaizer to make tokens consistent

prepareModel()

prepareModel() : null

Builds the model from the data source by applying transforms to the data source

Returns

null

classify()

classify( $document)

Parameters

$document

is()

is( $category,  $document)

Parameters

$category
$document

applyTransform()

applyTransform(callable $transform) : mixed

Take a callable and run it passing in any additionally specified arguments

Parameters

callable $transform

Throws

\RuntimeException

Returns

mixed