src/skipgram_mixture_neural_network.cpp
//The M Step: update the sense prior probabilities to maximize the Q function
The M Step: update the sense prior probabilities to maximize the Q function
The M Step : update the sense prior probabilities to maximize the Q function
void SkipGramMixtureNeuralNetwork<T>::MaximizeSensePriors(int word_input, T* log_likelihood)
{
	if (m_word_sense_info->word_sense_cnts_info[word_input] == 1)
	{
		return;
	}
	for (int sense_idx = 0; sense_idx < m_word_sense_info->word_sense_cnts_info[word_input]; ++sense_idx)
	{
		T new_alpha = log_likelihood[sense_idx];
		m_sense_priors_paras_ptr[word_input][sense_idx] = m_sense_priors_paras_ptr[word_input][sense_idx] * sense_prior_momentum + new_alpha * (1 - sense_prior_momentum);
	}
	if (!m_option->store_multinomial)
		Util::SoftMax(m_sense_priors_paras_ptr[word_input], m_sense_priors_ptr[word_input], m_option->sense_num_multi); 
}
void SkipGramMixtureNeuralNetwork < T > :: MaximizeSensePriors ( int word_input , T * log_likelihood ) { if ( m_word_sense_info -> word_sense_cnts_info [ word_input ] == 1 ) { return ; } for ( int sense_idx = 0 ; sense_idx < m_word_sense_info -> word_sense_cnts_info [ word_input ] ; ++ sense_idx ) { T new_alpha = log_likelihood [ sense_idx ] ; m_sense_priors_paras_ptr [ word_input ] [ sense_idx ] = m_sense_priors_paras_ptr [ word_input ] [ sense_idx ] * sense_prior_momentum + new_alpha * ( 1 - sense_prior_momentum ) ; } if ( ! m_option -> store_multinomial ) Util :: SoftMax ( m_sense_priors_paras_ptr [ word_input ] , m_sense_priors_ptr [ word_input ] , m_option -> sense_num_multi ) ; }
The M Step: update the sense prior probabilities to maximize the Q function
The M Step : update the sense prior probabilities to maximize the Q function
//Update the multinomial parameters