def log_likelihood(self, x):
        """
        Compute the log likelihood of the given A and W
        :param x:  an (A,W) tuple
        :return:
        """
        A,W = x
        assert isinstance(A, np.ndarray) and A.shape == (self.K,self.K), \
            "A must be a KxK adjacency matrix"
        assert isinstance(W, np.ndarray) and W.shape == (self.K,self.K), \
            "W must be a KxK weight matrix"

        # LL of A
        rho = self.network.P
        lp_A = (A * np.log(rho) + (1-A) * np.log(1-rho))

        # Get the shape and scale parameters from the network model
        kappa = self.network.kappa
        v = self.network.V

        # Add the LL of the gamma weights
        # lp_W = np.zeros((self.K, self.K))
        # lp_W = A * (kappa * np.log(v) - gammaln(kappa)
        #             + (kappa-1) * np.log(W) - v * W)

        lp_W0 = (self.kappa_0 * np.log(self.nu_0) - gammaln(self.kappa_0)
                    + (self.kappa_0-1) * np.log(W) - self.nu_0 * W)[A==0]

        lp_W1 = (kappa * np.log(v) - gammaln(kappa)
                    + v * W - (kappa-1) * np.log(W))[A==1]

        # lp_W = A * (kappa * np.log(v) - gammaln(kappa)
        #             + (kappa-1) * np.log(W) - v * W) + \
        #        (1-A) * (self.kappa_0 * np.log(self.nu_0) - gammaln(self.kappa_0)
        #                 + (self.kappa_0-1) * np.log(W) - self.nu_0 * W)
        ll = lp_A.sum() + lp_W0.sum() + lp_W1.sum()

        return ll
dataset/ETHPy150Open slinderman/pyhawkes/pyhawkes/internals/weights.py/GammaMixtureWeights.log_likelihood/swapped operands of `-`