43 CandidateSetMessage *candidate_set_message)
48 CandidateMessage *candidate_message =
49 candidate_set_message->add_candidate();
56 ScoreMessage *loss_message = candidate_message->add_score();
57 loss_message->set_type(ScoreMessage::LOSS);
58 loss_message->set_score(candidate.
loss());
60 ScoreMessage *model_score_message = candidate_message->add_score();
61 model_score_message->set_type(ScoreMessage::OUTPUT_SCORE);
62 model_score_message->set_score(candidate.
score());
64 ScoreMessage *baseline_score_message = candidate_message->add_score();
65 baseline_score_message->set_type(ScoreMessage::SYSTEM_SCORE);
69 FeatureVecMessage *fv_message = candidate_message->mutable_feats();
70 fv_writer_.Write(candidate.
features(), FeatureMessage::BASIC, fv_message);
72 FeatureMessage::BASIC, fv_message);
76 candidate_set_message->set_gold_index(set.
gold_index());
79 candidate_set_message->set_source_key(set.
training_key());
const string & reference_string() const
double score() const
Returns the reranker’s score for this candidate.
void Write(const CandidateSet &set, CandidateSetMessage *candidate_set_message) const
Serializes a CandidateSet instance to a CandidateSetMessage.
const string & raw_data() const
Returns the raw data (typically the sentence) for this candidate.
const string & training_key() const
const FeatureVector< string, double > & symbolic_features() const
Returns the symbolic feature vector for this candidate.
double baseline_score() const
Returns the baseline model score for this candidate.
Serializer for reranker::CandidateSet instances to CandidateSetMessage instances. ...
A class to hold a set of candidates, either for training or test.
A class to represent a candidate in a set of candidates that constitutes a training instance for a re...
vector< shared_ptr< Candidate > >::const_iterator const_iterator
size_t best_scoring_index() const
const_iterator begin() const
double loss() const
Returns the loss of this candidate.
void set_raw_data(const string &raw_data)
Sets the raw data (typically the sentence) for this candidate).
const_iterator end() const
size_t gold_index() const
const FeatureVector< int, double > & features() const
Returns the feature vector for this candidate.