output weight formatted according to discussions with Ken & Barry

This commit is contained in:
hieu 2012-12-12 12:22:13 +00:00
parent 00e6e6f0b6
commit 5ab3c3f081
2 changed files with 7 additions and 5 deletions

View File

@ -467,7 +467,7 @@ void OutputFeatureScores( std::ostream& out
if (ff->GetNumScoreComponents() != ScoreProducer::unlimited) {
if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) {
lastName = ff->GetScoreProducerDescription();
out << " " << lastName << ":";
out << " " << lastName << "=";
}
vector<float> scores = features.GetScoresForProducer( ff );
for (size_t j = 0; j<scores.size(); ++j) {
@ -482,15 +482,17 @@ void OutputFeatureScores( std::ostream& out
// report weighted aggregate
if (! ff->GetSparseFeatureReporting()) {
const FVector &weights = staticData.GetAllWeights().GetScoresVector();
if (labeledOutput && !boost::contains(ff->GetScoreProducerDescription(), ":"))
out << " " << ff->GetScoreProducerDescription() << ":";
if (labeledOutput && lastName != ff->GetScoreProducerDescription()) {
lastName = ff->GetScoreProducerDescription();
out << " " << lastName << "=";
}
out << " " << scores.inner_product(weights);
}
// report each feature
else {
for(FVector::FNVmap::const_iterator i = scores.cbegin(); i != scores.cend(); i++)
out << " " << i->first << ": " << i->second;
out << " " << i->first << "= " << i->second;
/* if (i->second != 0) { // do not report zero-valued features
float weight = staticData.GetSparseWeight(i->first);
if (weight != 0)

View File

@ -21,7 +21,7 @@ ScoreProducer::ScoreProducer(const std::string& description, size_t numScoreComp
ostringstream dstream;
dstream << description;
dstream << "_" << index;
dstream << index;
description_counts.insert(description);