120e438fcd6357fc81a979d92b39b2bd7101dd34,pymc/step_methods/metropolis.py,BinaryMetropolis,astep,#BinaryMetropolis#Any#Any#,152

Before Change



        // Calculate probabilities of each value
        logp_true = logp([True]*len(q0))
        logp_false = logp([False]*len(q0))

        p_true = exp(logp_true)
        p_false = exp(logp_false)

        // Stochastically set value according to relative
        // probabilities of True and False
        return (random(len(q0)) < p_true / (p_true + p_false)).astype(int)

After Change


        // Convert adaptive_scale_factor to a jump probability
        p_jump = 1.-.5**self.scaling

        rand_array = random(q0.shape)
        q = copy(q0)
        // Locations where switches occur, according to p_jump
        switch_locs = where(rand_array<p_jump)
        q[switch_locs] = True - q[switch_locs]

        q_new = metrop_select(logp(q) - logp(q0), q, q0)

        return q_new

def subst(a, val, index):
    ap = a.copy()
    ap[index]=val
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: pymc-devs/pymc3
Commit Name: 120e438fcd6357fc81a979d92b39b2bd7101dd34
Time: 2013-05-05
Author: chris.fonnesbeck@vanderbilt.edu
File Name: pymc/step_methods/metropolis.py
Class Name: BinaryMetropolis
Method Name: astep


Project Name: pymc-devs/pymc3
Commit Name: d3443536f3d4e39d5e0b8f90e1f9d0e25af77713
Time: 2013-05-06
Author: chris.fonnesbeck@vanderbilt.edu
File Name: pymc/step_methods/metropolis.py
Class Name: BinaryMetropolis
Method Name: astep


Project Name: freelunchtheorem/Conditional_Density_Estimation
Commit Name: da42c137d164ab56a1f1919c8f0ee21e6172f120
Time: 2018-03-20
Author: jonas.rothfuss@gmx.de
File Name: cde/evaluation/GoodnessOfFit.py
Class Name: GoodnessOfFit
Method Name: hellinger_distance_monte_carlo