app/corex.py
def calculate_p_y_xi(self, X_event, p_y_given_x):
        """Estimate log p(y_j|x_i) using a tiny bit of Laplace smoothing to avoid infinities."""
        pseudo_counts = 0.001 + np.dot(X_event, p_y_given_x).transpose((1,0,2))  # n_hidden, n_events, dim_hidden
        log_marg = np.log(pseudo_counts) - np.log(np.sum(pseudo_counts, axis=2, keepdims=True))
        return log_marg
Estimate log p(y_j|x_i) using a tiny bit of Laplace smoothing to avoid infinities.
Estimate log p(y_j|x_i) using a tiny bit of Laplace smoothing to avoid infinities.
Estimate log p ( y_j|x_i ) using a tiny bit of Laplace smoothing to avoid infinities .
def calculate_p_y_xi(self, X_event, p_y_given_x):
        pseudo_counts = 0.001 + np.dot(X_event, p_y_given_x).transpose((1,0,2))  
        log_marg = np.log(pseudo_counts) - np.log(np.sum(pseudo_counts, axis=2, keepdims=True))
        return log_marg
def calculate_p_y_xi ( self , X_event , p_y_given_x ) : pseudo_counts = 0.001 + np . dot ( X_event , p_y_given_x ) . transpose ( ( 1 , 0 , 2 ) ) log_marg = np . log ( pseudo_counts ) - np . log ( np . sum ( pseudo_counts , axis = 2 , keepdims = True ) ) return log_marg
Estimate log p(y_j|x_i) using a tiny bit of Laplace smoothing to avoid infinities.
Estimate log p ( y_j|x_i ) using a tiny bit of Laplace smoothing to avoid infinities .
"""Estimate log p(y_j|x_i) using a tiny bit of Laplace smoothing to avoid infinities.""" # n_hidden, n_events, dim_hidden
self
X_event
p_y_given_x