Tanl Linguistic Pipeline

Tanl::Classifier::Classifier Class Reference
[Classifier]

Abstract class for ML classifiers. More...

#include <Classifier.h>

Inheritance diagram for Tanl::Classifier::Classifier:
Parser::MlpModel Tanl::Classifier::MaxEnt Tanl::Classifier::GIS Tanl::Classifier::LBFGS

List of all members.

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::WordIndexPredIndex ()

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

Detailed Description

Abstract class for ML classifiers.


Member Function Documentation

ClassID Tanl::Classifier::Classifier::BestOutcome ( double *  ocs  )  const

Return the ID of the outcome corresponding to the highest likelihood in.

Parameters:
ocs. 
ocs A double[] as returned by the estimate() method.
Returns:
The classID of the most likely outcome.

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.

Returns:
The number of outcomes.

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.

Parameters:
c an outcome label.
Returns:
the ID of c.

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.

Parameters:
i An outcome id.
Returns:
The name of the outcome associated with that 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.

Parameters:
name The name of a predicate.
Returns:
The id associated to the predicate.
std::string Tanl::Classifier::Classifier::PredicateName ( int  i  )  const [inline]

Return the name of an predicate corresponding to an int id.

Parameters:
i An predicate id.
Returns:
The name of the predicate associated with that id.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
 
Copyright © 2005-2011 G. Attardi. Generated on 4 Mar 2011 by doxygen 1.6.1.