Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
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 |
Candidate & | Get (size_t idx) |
const Candidate & | GetGold () const |
const Candidate & | GetBestScoring () 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) |
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.
typedef vector<shared_ptr<Candidate> >::const_iterator reranker::CandidateSet::const_iterator |
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.
|
inline |
Constructs a new candidate set with no information set.
Definition at line 65 of file candidate-set.H.
|
inline |
Constructs a candidate set with the specified key.
key | the unique key that identifies this candidate set |
Definition at line 69 of file candidate-set.H.
|
inlinevirtual |
Destroys this instance.
Definition at line 71 of file candidate-set.H.
|
inline |
Definition at line 133 of file candidate-set.H.
|
inline |
Definition at line 86 of file candidate-set.H.
|
inline |
Definition at line 90 of file candidate-set.H.
|
inline |
Definition at line 96 of file candidate-set.H.
|
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.
|
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.
|
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.
symbols | the map from symbols (string instances) to unique integer id’s |
clear_features | whether to clear each candidate’s “normal” feature vector prior to compiling symbolic features |
clear_symbolic_features | whether to clear each candidate’s symbolic feature vector after updating the “regular” feature vector (to save space) |
force | forces feature compilation on each candidate, even if this method has been previously invoked |
Definition at line 163 of file candidate-set.H.
|
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.
symbols | the map from symbols (string instances) to unique integer id’s |
clear_symbolic_features | whether to clear each candidate’s symbolic feature vector prior to decompiling features |
clear_features | whether to clear each candidate’s “normal” feature vector after updating the symbolic feature vector (to save space) |
force | forces feature decompilation on each candidate, even if this method has been previously invoked |
Definition at line 197 of file candidate-set.H.
|
inline |
Definition at line 88 of file candidate-set.H.
|
inline |
Definition at line 92 of file candidate-set.H.
|
inline |
Definition at line 101 of file candidate-set.H.
|
inline |
Definition at line 108 of file candidate-set.H.
|
inline |
Definition at line 105 of file candidate-set.H.
|
inline |
Definition at line 97 of file candidate-set.H.
|
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.
|
inline |
Definition at line 112 of file candidate-set.H.
|
inline |
Definition at line 114 of file candidate-set.H.
|
inline |
Definition at line 218 of file candidate-set.H.
|
inline |
Definition at line 222 of file candidate-set.H.
|
inline |
Definition at line 230 of file candidate-set.H.
|
inline |
Definition at line 234 of file candidate-set.H.
|
inline |
Definition at line 226 of file candidate-set.H.
|
inline |
Definition at line 94 of file candidate-set.H.
|
inline |
Definition at line 99 of file candidate-set.H.
|
friend |
Definition at line 240 of file candidate-set.H.