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

Before Change


            Id = np.identity(s)

            if self.kernel_type == "geometric":
                return np.linalg.multi_dot(
                    (np.ones(s),
                     inv(Id - self.lamda*XY).T, np.ones(shape=(s))))
            elif self.kernel_type == "exponential":
                return np.linalg.multi_dot((np.ones(s),
                                            expm(self.lamda*XY).T,
                                            np.ones(shape=(s))))

        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
            // witout labels

            // calculate kernel
            qi_Pi, wi, Pi_inv_pi = X
            qj_Pj, wj, Pj_inv_pj = Y

            // 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):

After Change


                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
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: deepchem/deepchem
Commit Name: ec30c1451474433f77b2caa609f04e6688965c1e
Time: 2020-07-19
Author: shak360@gmail.com
File Name: deepchem/models/tests/test_layers.py
Class Name: TestLayers
Method Name: test_cosine_dist


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: mne-tools/mne-python
Commit Name: 9613c71f24b8f3f289fcbace86be57dcc66360ed
Time: 2020-07-20
Author: larson.eric.d@gmail.com
File Name: mne/channels/interpolation.py
Class Name:
Method Name: _make_interpolation_matrix