25d18ec72f1a113ee42456125fc3557a0d5ce135,pgmpy/inference/continuous_sampling.py,HamiltonianMC,generate_sample,#HamiltonianMC#Any#Any#Any#Any#,203

Before Change


                theta_bar, momentum_bar = self.discretize_time(self.grad_log_pdf, self.model, theta_bar.copy(),
                                                               momentum_bar.copy(), epsilon).discretize_time()

            _, log_bar = self.grad_log_pdf(theta_bar.copy(), self.model).get_gradient_log_pdf()
            // log_m_1 = log(theta_m) or log(theta_m_1)
            _, log_m_1 = self.grad_log_pdf(theta_m.copy(), self.model).get_gradient_log_pdf()

            // Metropolis acceptance probability
            alpha = min(1, np.exp(log_bar - log_m_1 - 0.5 *
                                  np.float(np.dot(momentum_bar.T, momentum_bar) - np.dot(momentum0.T, momentum0))))

            // Accept or reject the new proposed value of theta, i.e theta_bar
            if np.random.rand() < alpha:
                theta_m = theta_bar.copy()

After Change


                theta_bar, momentum_bar = self.discretize_time(self.grad_log_pdf, self.model, theta_bar.copy(),
                                                               momentum_bar.copy(), epsilon).discretize_time()

            acceptance_prob = self._acceptance_prob(theta_m.copy(), theta_bar.copy(), momentum0, momentum_bar)
            // Metropolis acceptance probability
            alpha = min(1, acceptance_prob)
            // Accept or reject the new proposed value of theta, i.e theta_bar
            if np.random.rand() < alpha:
                theta_m = theta_bar.copy()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 20

Instances


Project Name: pgmpy/pgmpy
Commit Name: 25d18ec72f1a113ee42456125fc3557a0d5ce135
Time: 2016-06-17
Author: utkarsh.gupta550@gmail.com
File Name: pgmpy/inference/continuous_sampling.py
Class Name: HamiltonianMC
Method Name: generate_sample


Project Name: pgmpy/pgmpy
Commit Name: 25d18ec72f1a113ee42456125fc3557a0d5ce135
Time: 2016-06-17
Author: utkarsh.gupta550@gmail.com
File Name: pgmpy/inference/continuous_sampling.py
Class Name: HamiltonianMC
Method Name: generate_sample


Project Name: pgmpy/pgmpy
Commit Name: 25d18ec72f1a113ee42456125fc3557a0d5ce135
Time: 2016-06-17
Author: utkarsh.gupta550@gmail.com
File Name: pgmpy/inference/continuous_sampling.py
Class Name: HamiltonianMCda
Method Name: generate_sample


Project Name: pgmpy/pgmpy
Commit Name: 25d18ec72f1a113ee42456125fc3557a0d5ce135
Time: 2016-06-17
Author: utkarsh.gupta550@gmail.com
File Name: pgmpy/inference/continuous_sampling.py
Class Name: HamiltonianMC
Method Name: sample


Project Name: pgmpy/pgmpy
Commit Name: 25d18ec72f1a113ee42456125fc3557a0d5ce135
Time: 2016-06-17
Author: utkarsh.gupta550@gmail.com
File Name: pgmpy/inference/continuous_sampling.py
Class Name: HamiltonianMCda
Method Name: sample