e822a02daa1cd1c42f6d2bf309d5996a21979ef1,qucumber/tests/test_grads_positive.py,,algorithmic_gradKL,#Any#Any#Any#,75

Before Change


    return NLL

def algorithmic_gradKL(nn_state,target_psi,vis):
    grad_KL={}
    for rbmType in nn_state.gradient(vis[0]):
        grad_KL[rbmType] = {}
        for pars in nn_state.gradient(vis[0])[rbmType]:
            grad_KL[rbmType][pars]=0
    Z = partition(nn_state,vis)
    for i in range(len(vis)):
        for rbmType in nn_state.gradient(vis[i]):
            for pars in nn_state.gradient(vis[i])[rbmType]:

After Change


    //    for pars in nn_state.gradient(vis[0])[rbmType]:
    //        grad_KL[rbmType][pars]=0
    Z = partition(nn_state,vis)
    grad_KL = torch.zeros(nn_state.rbm_am.num_pars,dtype=torch.double)
    for i in range(len(vis)):
        grad_KL += ((target_psi[i,0])**2)*nn_state.gradient(vis[i]) 
        grad_KL -=probability(nn_state,vis[i], Z)*nn_state.gradient(vis[i])
        //for rbmType in nn_state.gradient(vis[i]):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: PIQuIL/QuCumber
Commit Name: e822a02daa1cd1c42f6d2bf309d5996a21979ef1
Time: 2018-07-31
Author: gtorlai@uwaterloo.ca
File Name: qucumber/tests/test_grads_positive.py
Class Name:
Method Name: algorithmic_gradKL


Project Name: EpistasisLab/tpot
Commit Name: 2ab8c1444facbd46df8767a5badda5b9f1a50c29
Time: 2016-08-01
Author: supacoofoo@gmail.com
File Name: tpot/tpot.py
Class Name: TPOT
Method Name: predict


Project Name: uber/pyro
Commit Name: cce694178ae66b3a84623d517ffdf0c1bb32ba27
Time: 2020-05-11
Author: fehiepsi@gmail.com
File Name: pyro/infer/mcmc/hmc.py
Class Name: HMC
Method Name: _sample_r