Tanl Linguistic Pipeline |
Abstract class for ML classifiers. More...
#include <Classifier.h>
Public Member Functions | |
Classifier (char const *file) | |
Create classifier from model file. | |
Classifier (std::istream &ifs) | |
Create classifier reading model from stream ifs. | |
ClassID | BestOutcome (double *ocs) const |
Return the ID of the outcome corresponding to the highest likelihood in. | |
char const * | OutcomeName (int i) const |
Return the name of an outcome corresponding to an int id. | |
ClassID | OutcomeID (char const *c) const |
Return the ID of an outcome. | |
int | NumOutcomes () const |
Returns the number of outcomes for this model. | |
std::string | PredicateName (int i) const |
Return the name of an predicate corresponding to an int id. | |
int | PredicateIndex (char const *name) |
Return the index of an predicate gives its name. | |
void | load (std::istream &is) |
Load the model from file. | |
void | save (char const *file) |
Save the model to file. | |
Text::WordIndex & | PredIndex () |
Public Attributes | |
bool | verbose |
Control whether to print progress indication. | |
Protected Attributes | |
std::vector< std::string > | predLabels |
Text::WordIndex | predIndex |
std::vector< char const * > | outcomeLabels |
ClassID | numOutcomes |
Abstract class for ML classifiers.
ClassID Tanl::Classifier::Classifier::BestOutcome | ( | double * | ocs | ) | const |
Return the ID of the outcome corresponding to the highest likelihood in.
ocs. | ||
ocs | A double[] as returned by the estimate() method. |
Reimplemented in Tanl::Classifier::MaxEnt.
Referenced by Parser::MlpParser::parse().
int Tanl::Classifier::Classifier::NumOutcomes | ( | ) | const [inline] |
Returns the number of outcomes for this model.
Referenced by Tanl::SST::SSTPipe::Current(), Parser::MlpParser::parse(), Parser::MeParser::parse(), Parser::MeParser::revise(), and Tanl::NER::NER::tag().
ClassID Tanl::Classifier::Classifier::OutcomeID | ( | char const * | c | ) | const [inline] |
Return the ID of an outcome.
c | an outcome label. |
Referenced by Tanl::SST::SSTPipe::Current(), and Tanl::NER::NER::tag().
char const* Tanl::Classifier::Classifier::OutcomeName | ( | int | i | ) | const [inline] |
Return the name of an outcome corresponding to an int id.
i | An outcome id. |
Referenced by Tanl::SST::SSTPipe::Current(), Parser::MlpParser::parse(), Parser::MeParser::parse(), and Parser::MeParser::revise().
int Tanl::Classifier::Classifier::PredicateIndex | ( | char const * | name | ) | [inline] |
Return the index of an predicate gives its name.
name | The name of a predicate. |
std::string Tanl::Classifier::Classifier::PredicateName | ( | int | i | ) | const [inline] |
Return the name of an predicate corresponding to an int id.
i | An predicate id. |