Public Member Functions | Data Fields

Classifier Interface Reference

Predicts the most suitable category label for given textual data. More...

Inheritance diagram for Classifier:
Inheritance graph
[legend]

Public Member Functions

 train (array &$dataTrain, array &$dataLabel)
 Trains the classifier with the given example data.
 setDatabase ($name)
 Sets the name of the database to operate on.
 save ()
 Uploads the learnt parameters to a new database.
 classify ($dataTest)
 Predicts the most suitable category label for the given test data.

Data Fields

const OOV = "__OOV__"
 Out-of-vocabulary common symbol.

Detailed Description

Predicts the most suitable category label for given textual data.

Author:
Alexandre Trilla (atrilla)

Definition at line 44 of file Classifier.php.


Member Function Documentation

Classifier::classify ( dataTest  ) 

Predicts the most suitable category label for the given test data.

Parameters:
dataTest The test data, e.g., in textual form.
Returns:
The predicted category label.
Exceptions:
Exception if the connection to the working database cannot be established.
Precondition:
The test data should be a valid string.
A trained model should be available on the working database, i.e., an existing and non-empty database.
Postcondition:
The most appropriate category label is delivered.

Implemented in MultinomialNaiveBayes.

Classifier::save (  ) 

Uploads the learnt parameters to a new database.

Exceptions:
Exception if the connection to the database management system fails.
Precondition:
The classifier should be trained in computer memory.
A valid and original database name should be set.
Postcondition:
The learnt parameters are saved on the new database.

Implemented in MultinomialNaiveBayes.

Classifier::setDatabase ( name  ) 

Sets the name of the database to operate on.

Parameters:
name Name of the working database.
Precondition:
The given name should be a valid string.
Postcondition:
The name of the working database is set.

Implemented in MultinomialNaiveBayes.

Classifier::train ( array &$  dataTrain,
array &$  dataLabel 
)

Trains the classifier with the given example data.

Parameters:
dataTrain Data instances, e.g., in textual form.
dataLabel Instance labels.
Exceptions:
Exception if data/label sizes don't match, i.e., different numbers of labelled instances are given.
Precondition:
Parameters must be arrays of the same length.
Postcondition:
Classification model is learnt in computer memory.

Implemented in MultinomialNaiveBayes.


Field Documentation

const Classifier::OOV = "__OOV__"

Out-of-vocabulary common symbol.

Definition at line 49 of file Classifier.php.

Referenced by MultinomialNaiveBayes::classify(), and MultinomialNaiveBayes::train().


The documentation for this interface was generated from the following file: