could not understand the purpose of this line:

log_ppx = np.sum(None, None) / np.sum(None, None) # Remember to set the axis properly when summing up

Why do we need a division?

could not understand the purpose of this line:

log_ppx = np.sum(None, None) / np.sum(None, None) # Remember to set the axis properly when summing up

Why do we need a division?

@wxlwang , The denominator part is that 1/N in the final step of the formula given just above. Multiplying by 1/N is same as dividing by N, isn’t it?

Thanks! I thought it is the mean of all log_probability. Now I got it. It calculates the log_perplexity of each sentence and then mean of corpus’ log_perplexity.