6967cc5df1801b8f5a01110417b38495896d75e0,src/spn/structure/leaves/cltree/Inference.py,,cltree_likelihood,#,9

Before Change


from spn.algorithms.Inference import add_node_likelihood

def cltree_likelihood(node, data=None, dtype=np.float64):
    raise ValueError("Not Implemented")

def add_cltree_inference_support():
    add_node_likelihood(CLTree, cltree_likelihood)

After Change


import numpy as np

def cltree_likelihood(node, data=None, dtype=np.float64):
    probs = np.zeros(data.shape[0], dtype=dtype)

    for feature in range(0, node.n_features):
        parent = node.tree[feature]
        if parent == -1:
            probs = probs + node.log_factors[feature, data[:,node.scope[feature]],0]
        else:
            probs = probs + node.log_factors[feature, data[:,node.scope[feature]], data[:,node.scope[parent]]]

    return np.exp(probs.reshape(data.shape[0],1))
    
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: SPFlow/SPFlow
Commit Name: 6967cc5df1801b8f5a01110417b38495896d75e0
Time: 2018-10-23
Author: nicola.dimauro@uniba.it
File Name: src/spn/structure/leaves/cltree/Inference.py
Class Name:
Method Name: cltree_likelihood


Project Name: pymanopt/pymanopt
Commit Name: 17522b968c8a1d2b29d0034fc57cec59ed9972de
Time: 2016-03-15
Author: git@sweichwald.de
File Name: pymanopt/tools/autodiff/_tensorflow.py
Class Name: TensorflowBackend
Method Name: compute_hessian


Project Name: utiasSTARS/liegroups
Commit Name: a5f02ec13bb412961b1ab5a470c5b4d9b6a7f2bc
Time: 2017-10-23
Author: clement.leopold@gmail.com
File Name: liegroups/numpy/se3.py
Class Name: SE3
Method Name: left_jacobian