67   model->ScoreCandidate(*(*it), training);
 
   74   for ( ; it != candidates.end(); ++it) {
 
   76     model->ScoreCandidate(candidate, training);
 
   77     if (model->score_comparator()->Compare(*model, candidate, **best_it) > 0) {
 
   80     if (model->gold_comparator()->Compare(*model, candidate, **gold_it) > 0) {
 
   84   candidates.set_best_scoring_index((*best_it)->index());
 
   85   candidates.set_gold_index((*gold_it)->index());
 
   95 RandomPairCandidateSetScorer::GetRandomIndex(
size_t max) {
 
   99   double r = rand() / (double)RAND_MAX;
 
  105   double denominator = (max * (max + 1)) / 2;
 
  106   for (
size_t i = 0; i < max; ++i) {
 
  107     cdf += (max - i) / denominator;
 
  116 RandomPairCandidateSetScorer::Score(
Model *model,
 
  119   size_t idx1 = GetRandomIndex(candidates.
size());
 
  120   size_t idx2 = GetRandomIndex(candidates.
size());
 
  137 Model::CheckNumberOfTokens(
const string &arg,
 
  138                            const vector<string> &tokens,
 
  139                            size_t min_expected_number,
 
  140                            size_t max_expected_number,
 
  141                            const string &class_name)
 const {
 
  142   if ((min_expected_number > 0 && tokens.size() < min_expected_number) ||
 
  143       (max_expected_number > 0 && tokens.size() > max_expected_number)) {
 
  144     std::stringstream err_ss;
 
  145     err_ss << class_name << 
"::Init: error parsing init string \"" 
  146            << arg << 
"\": expected between " 
  147            << min_expected_number << 
" and " << max_expected_number
 
  148            << 
" tokens but found " << tokens.size() << 
" tokens";
 
  149     cerr << err_ss.str() << endl;
 
  150     throw std::runtime_error(err_ss.str());
 
  154 shared_ptr<Candidate::Comparator>
 
  155 Model::GetComparator(
const string &spec)
 const {
 
  157   string err_msg = 
"error: model " + name() + 
": could not construct " +
 
  158       "Candidate::Comparator from specification string \"" + spec + 
"\"";
 
  159   return  comparator_factory.
CreateOrDie(spec, err_msg);
 
  162 shared_ptr<CandidateSet::Scorer>
 
  163 Model::GetCandidateSetScorer(
const string &spec)
 const {
 
  165   string err_msg = 
"error: model " + name() + 
": could not construct " +
 
  166       "Candidate::Scorer from specification string \"" + spec + 
"\"";
 
  167   return candidate_set_scorer_factory.
CreateOrDie(spec, err_msg);
 
  170 shared_ptr<Model::UpdatePredicate>
 
  171 Model::GetUpdatePredicate(
const string &spec)
 const {
 
  173   string err_msg = 
"error: model " + name() + 
": could not construct " +
 
  174       "Model::UpdatePredicate from specification string \"" + spec + 
"\"";
 
  175   return update_predicate_factory.
CreateOrDie(spec, err_msg);
 
  178 shared_ptr<Model::Updater>
 
  179 Model::GetUpdater(
const string &spec)
 const {
 
  181   string err_msg = 
"error: model " + name() + 
": could not construct " +
 
  182       "Model::Updater from specification string \"" + spec + 
"\"";
 
Model is an interface for reranking models. 
 
#define REGISTER_CANDIDATE_COMPARATOR(TYPE)
 
The default comparator for comparing two Candidate instances based on their respective scores (i...
 
vector< shared_ptr< Candidate > >::iterator iterator
 
Provides the Tokenizer  class. 
 
The default comparator for comparing two Candidate instances for being the “gold” candidate...
 
virtual shared_ptr< Candidate::Comparator > score_comparator()
Returns a pointer to the score comparator used by this model. 
 
Factory for dynamically created instance of the specified type. 
 
int index() const 
Returns the index of this candidate relative to the other candidates. 
 
This candidate set scorer picks two candidates at random from the set, scores them and then identifie...
 
void set_gold_index(size_t index)
 
A class to hold a set of candidates, either for training or test. 
 
shared_ptr< T > CreateOrDie(StreamTokenizer &st, Environment *env=NULL)
Dynamically creates an object, whose type and initialization are contained in a specification string...
 
An interface for an environment in which variables of various types are mapped to their values...
 
A class to represent a candidate in a set of candidates that constitutes a training instance for a re...
 
virtual shared_ptr< Candidate::Comparator > gold_comparator()
Returns a pointer to the gold comparator used by this model. 
 
#define IMPLEMENT_FACTORY(BASE)
Provides the necessary implementation for a factory for the specified BASE class type. 
 
#define REGISTER_CANDIDATE_SET_SCORER(TYPE)
 
Candidate & Get(size_t idx)
 
The default candidate set scorer scores each candidate using the Model::ScoreCandidate method and the...
 
void set_best_scoring_index(size_t index)
 
Reranker model interface. 
 
virtual double ScoreCandidate(Candidate &candidate, bool training)=0
Scores a candidate according to either the raw or averaged version of this perceptron model...