refactor get_log_probability_f()