src/Generic/names/IdFModel.cpp
/**
 *  Assumes deriveTagTables has been called already. Given the counts contained
 *  in the tables filled in by deriveTagTables, it fills in the
 *  tag lambda tables.
 *
 *  Can be called as many times as needed (for instance, when we change the values
 *  of the multipliers in estimating the smoothing parameters) -- it resets the 
 *  tables at the beginning of each call. 
 */
Assumes deriveTagTables has been called already. Given the counts contained
in the tables filled in by deriveTagTables, it fills in the
tag lambda tables.

Can be called as many times as needed (for instance, when we change the values
of the multipliers in estimating the smoothing parameters) -- it resets the
tables at the beginning of each call.
Assumes deriveTagTables has been called already . Given the counts contained in the tables filled in by deriveTagTables it fills in the tag lambda tables . Can be called as many times as needed ( for instance when we change the values of the multipliers in estimating the smoothing parameters ) -- it resets the tables at the beginning of each call .
void IdFModel::deriveTagLambdas() {
	if (DECODE) {
		SessionLogger::info("SERIF") << "can't derive tag lambdas during decode\n";
		return;
	}
	_tagFullLambdas->reset();
	NgramScoreTable::Table::iterator iter;
	for (iter = _tagFullHistories->get_start(); iter != _tagFullHistories->get_end(); ++iter) {
		float histories = (*iter).second;
		float uniques = _tagUniqueCounts->lookup((*iter).first);
		_tagFullLambdas->add((*iter).first, 
			histories / (histories + _tagWBMultiplier * uniques));
	}
}
void IdFModel :: deriveTagLambdas ( ) { if ( DECODE ) { SessionLogger :: info ( " " ) << " \n " ; return ; } _tagFullLambdas -> reset ( ) ; NgramScoreTable :: Table :: iterator iter ; for ( iter = _tagFullHistories -> get_start ( ) ; iter != _tagFullHistories -> get_end ( ) ; ++ iter ) { float histories = ( * iter ) . second ; float uniques = _tagUniqueCounts -> lookup ( ( * iter ) . first ) ; _tagFullLambdas -> add ( ( * iter ) . first , histories / ( histories + _tagWBMultiplier * uniques ) ) ; } }
Assumes deriveTagTables has been called already.
Assumes deriveTagTables has been called already .