Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Friends | List of all members
reranker::CandidateSet Class Reference

A class to hold a set of candidates, either for training or test. More...

#include <candidate-set.H>

Classes

class  Scorer
 An inner interface for a model to score a CandidateSet. More...
 

Public Types

typedef vector< shared_ptr
< Candidate > >::iterator 
iterator
 
typedef vector< shared_ptr
< Candidate >
>::const_iterator 
const_iterator
 

Public Member Functions

 CandidateSet ()
 Constructs a new candidate set with no information set. More...
 
 CandidateSet (const string &key)
 Constructs a candidate set with the specified key. More...
 
virtual ~CandidateSet ()
 Destroys this instance. More...
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
size_t size () const
 
size_t best_scoring_index () const
 
size_t gold_index () const
 
const string & training_key () const
 
CandidateGet (size_t idx)
 
const CandidateGetGold () const
 
const CandidateGetBestScoring () const
 
const string & reference_string () const
 
int reference_string_token_count () const
 
double loss_weight () const
 Returns the weight of the loss for this candidate set’s reference. More...
 
bool compiled () const
 Returns whether any symbolic features in any of the candidates in this candidate set were compiled by an invocation of CompileFeatures or any previous invocations of CompileFeatures. More...
 
void AddCandidate (shared_ptr< Candidate > candidate)
 
bool CompileFeatures (Symbols *symbols, bool clear_features=false, bool clear_symbolic_features=true, bool force=false)
 Compiles any symbolic features in this candidate set. More...
 
void DecompileFeatures (Symbols *symbols, bool clear_symbolic_features=false, bool clear_features=true, bool force=false)
 Decompiles any non-symbolic features in the candidates in this candidate set. More...
 
void ClearRawData ()
 Clears the raw data for all candidates in this set by setting each to be the empty string. More...
 
void set_best_scoring_index (size_t index)
 
void set_gold_index (size_t index)
 
void set_training_key (const string &training_key)
 
void set_reference_string (const string &reference_string)
 
void set_reference_string_token_count (int reference_string_token_count)
 

Friends

ostream & operator<< (ostream &os, const CandidateSet &set)
 

Detailed Description

A class to hold a set of candidates, either for training or test.

During training, a candidate set typically consists of a reference instance with one or more candidate instances. During test, a candidate set is simply a set of candidate instances.

Definition at line 62 of file candidate-set.H.

Member Typedef Documentation

Definition at line 74 of file candidate-set.H.

typedef vector<shared_ptr<Candidate> >::iterator reranker::CandidateSet::iterator

Definition at line 73 of file candidate-set.H.

Constructor & Destructor Documentation

reranker::CandidateSet::CandidateSet ( )
inline

Constructs a new candidate set with no information set.

Definition at line 65 of file candidate-set.H.

reranker::CandidateSet::CandidateSet ( const string &  key)
inline

Constructs a candidate set with the specified key.

Parameters
keythe unique key that identifies this candidate set

Definition at line 69 of file candidate-set.H.

virtual reranker::CandidateSet::~CandidateSet ( )
inlinevirtual

Destroys this instance.

Definition at line 71 of file candidate-set.H.

Member Function Documentation

void reranker::CandidateSet::AddCandidate ( shared_ptr< Candidate candidate)
inline

Definition at line 133 of file candidate-set.H.

const_iterator reranker::CandidateSet::begin ( ) const
inline

Definition at line 86 of file candidate-set.H.

iterator reranker::CandidateSet::begin ( )
inline

Definition at line 90 of file candidate-set.H.

size_t reranker::CandidateSet::best_scoring_index ( ) const
inline

Definition at line 96 of file candidate-set.H.

void reranker::CandidateSet::ClearRawData ( )
inline

Clears the raw data for all candidates in this set by setting each to be the empty string.

Definition at line 212 of file candidate-set.H.

bool reranker::CandidateSet::compiled ( ) const
inline

Returns whether any symbolic features in any of the candidates in this candidate set were compiled by an invocation of CompileFeatures or any previous invocations of CompileFeatures.

Definition at line 130 of file candidate-set.H.

bool reranker::CandidateSet::CompileFeatures ( Symbols symbols,
bool  clear_features = false,
bool  clear_symbolic_features = true,
bool  force = false 
)
inline

Compiles any symbolic features in this candidate set.

For each candidate, feature weights for symbolic features will be added to those for any features already specified with int uid’s.

Parameters
symbolsthe map from symbols (string instances) to unique integer id’s
clear_featureswhether to clear each candidate’s “normal” feature vector prior to compiling symbolic features
clear_symbolic_featureswhether to clear each candidate’s symbolic feature vector after updating the “regular” feature vector (to save space)
forceforces feature compilation on each candidate, even if this method has been previously invoked
Returns
whether any symbolic features in any of the candidates in this candidate set were actually compiled by this method invocation or any previous invocations of this method
See Also
Candidate::Compile

Definition at line 163 of file candidate-set.H.

void reranker::CandidateSet::DecompileFeatures ( Symbols symbols,
bool  clear_symbolic_features = false,
bool  clear_features = true,
bool  force = false 
)
inline

Decompiles any non-symbolic features in the candidates in this candidate set.

For each candidate, feature weights for non-symbolic features will be added to those for any features already specified with string uid’s.

Parameters
symbolsthe map from symbols (string instances) to unique integer id’s
clear_symbolic_featureswhether to clear each candidate’s symbolic feature vector prior to decompiling features
clear_featureswhether to clear each candidate’s “normal” feature vector after updating the symbolic feature vector (to save space)
forceforces feature decompilation on each candidate, even if this method has been previously invoked
See Also
Candidate::Decompile

Definition at line 197 of file candidate-set.H.

const_iterator reranker::CandidateSet::end ( ) const
inline

Definition at line 88 of file candidate-set.H.

iterator reranker::CandidateSet::end ( )
inline

Definition at line 92 of file candidate-set.H.

Candidate& reranker::CandidateSet::Get ( size_t  idx)
inline

Definition at line 101 of file candidate-set.H.

const Candidate& reranker::CandidateSet::GetBestScoring ( ) const
inline

Definition at line 108 of file candidate-set.H.

const Candidate& reranker::CandidateSet::GetGold ( ) const
inline

Definition at line 105 of file candidate-set.H.

size_t reranker::CandidateSet::gold_index ( ) const
inline

Definition at line 97 of file candidate-set.H.

double reranker::CandidateSet::loss_weight ( ) const
inline

Returns the weight of the loss for this candidate set’s reference.

For now, this method returns the double representation of the value returned by the reference_string_token_count method.

Definition at line 122 of file candidate-set.H.

const string& reranker::CandidateSet::reference_string ( ) const
inline

Definition at line 112 of file candidate-set.H.

int reranker::CandidateSet::reference_string_token_count ( ) const
inline

Definition at line 114 of file candidate-set.H.

void reranker::CandidateSet::set_best_scoring_index ( size_t  index)
inline

Definition at line 218 of file candidate-set.H.

void reranker::CandidateSet::set_gold_index ( size_t  index)
inline

Definition at line 222 of file candidate-set.H.

void reranker::CandidateSet::set_reference_string ( const string &  reference_string)
inline

Definition at line 230 of file candidate-set.H.

void reranker::CandidateSet::set_reference_string_token_count ( int  reference_string_token_count)
inline

Definition at line 234 of file candidate-set.H.

void reranker::CandidateSet::set_training_key ( const string &  training_key)
inline

Definition at line 226 of file candidate-set.H.

size_t reranker::CandidateSet::size ( ) const
inline

Definition at line 94 of file candidate-set.H.

const string& reranker::CandidateSet::training_key ( ) const
inline

Definition at line 99 of file candidate-set.H.

Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
const CandidateSet set 
)
friend

Definition at line 240 of file candidate-set.H.


The documentation for this class was generated from the following files: