de35f42a16796d9aab141dd944d79b1d97cec350,grakel/kernels/random_walk.py,RandomWalk,pairwise_operation,#RandomWalk#Any#Any#,200

Before Change



            // calculate left right flanking factors
            fl = np.kron(qi_Pi, qj_Pj)
            fr = np.kron(Pi_inv_pi, Pj_inv_pj)

            // calculate D based on the method
            Dij = np.kron(wi, wj)
            if self.p is not None:
                Q = np.diagflat(Dij)
                D = np.eye(Q.shape[0])
                S = self._mu[0] * Q
                for k in self._mu[1:]:
                    D *= Q
                    S += k*D

            else:
                if self.kernel_type == "geometric":
                    D = np.diagflat(1/(1-self.lamda*Dij))
                elif self.kernel_type == "exponential":
                    D = np.diagflat(np.exp(self.lamda*Dij))
            return np.linalg.multi_dot((fl, D, fr))


class RandomWalkLabeled(RandomWalk):
    The labeled random walk kernel class.

After Change


            Id = np.identity(s)

            if self.p is not None:
                P = np.eye(XY.shape[0])
                S = self._mu[0] * P
                for k in self._mu[1:]:
                    P *= XY
                    S += k*P
            else:
                if self.kernel_type == "geometric":
                    S = inv(Id - self.lamda*XY).T
                elif self.kernel_type == "exponential":
                    S = expm(self.lamda*XY).T

            p = np.ones(shape=(1, s))
            return p.dot(S).dot(p.T)
        elif self.method_type == "fast":
            // Spectral demoposition algorithm as presented in
            // [Vishwanathan et al., 2006] p.13, s.4.4, with
            // complexity of O((|E|+|V|)|E||V|^2) for graphs
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: ysig/GraKeL
Commit Name: de35f42a16796d9aab141dd944d79b1d97cec350
Time: 2018-08-23
Author: y.siglidis@gmail.com
File Name: grakel/kernels/random_walk.py
Class Name: RandomWalk
Method Name: pairwise_operation


Project Name: PIQuIL/QuCumber
Commit Name: e7491685c122fd987947a7e9b0c0df4151aa0132
Time: 2018-07-29
Author: gtorlai@uwaterloo.ca
File Name: qucumber/utils/ed/pauli.py
Class Name:
Method Name: sigmaXsigmaX


Project Name: PIQuIL/QuCumber
Commit Name: e7491685c122fd987947a7e9b0c0df4151aa0132
Time: 2018-07-29
Author: gtorlai@uwaterloo.ca
File Name: qucumber/utils/ed/pauli.py
Class Name:
Method Name: sigmaYsigmaY