NlpTools API
Class

NlpTools\Classifiers\FeatureBasedLinearClassifier

class FeatureBasedLinearClassifier implements ClassifierInterface

Classify using a linear model.

A model that assigns a weight l for
each feature f.

Methods

__construct(FeatureFactoryInterface $ff, LinearModel $m)

string classify(array $classes, DocumentInterface $d)

Compute the vote for every class.

float getVote(string $class, DocumentInterface $d)

Compute the features that fire for the Document $d.

Details

at line 20
public __construct(FeatureFactoryInterface $ff, LinearModel $m)

at line 34
public string classify(array $classes, DocumentInterface $d)

Compute the vote for every class.

Return the class that
receive the maximum vote.

Parameters

array $classes A set of classes
DocumentInterface $d A Document

Return Value

string A class

at line 57
public float getVote(string $class, DocumentInterface $d)

Compute the features that fire for the Document $d.

The sum of
the weights of the features is the vote.

Parameters

string $class The vote for class $class
DocumentInterface $d The vote for Document $d

Return Value

float The vote of the model for class $class and Document $d