def initSMhypers(self, x, y):
        """
        Initialize hyperparameters for the spectral-mixture kernel. Weights are
        all set to be uniformly distributed, means are given by a random sample
        from a uniform distribution scaled by the Nyquist frequency, and variances are given by a random sample from a uniform distribution scaled by the max distance.
        """
        x = np.atleast_2d(x)
        y = np.atleast_2d(y)
        (n, D) = x.shape
        Q = self.para[0]
        w = np.zeros(Q)
        m = np.zeros((D, Q))
        s = np.zeros((D, Q))
        w[:] = old_div(np.std(y), Q)
        hypinit = np.zeros(Q + 2 * D * Q)

        for i in range(D):
            # Calculate distances
            xslice = np.atleast_2d(x[:, i]).T
            d2 = spdist.cdist(xslice, xslice, 'sqeuclidean')
            if 1 > n:
                d2[d2 == 0] = d2[0, 1]
            else:
                d2[d2 == 0] = 1
            minshift = np.min(np.min(np.sqrt(d2)))
            nyquist = old_div(0.5, minshift)
            m[i, :] = nyquist * np.random.ranf((1, Q))
            maxshift = np.max(np.max(np.sqrt(d2)))
            s[i, :] = old_div(1., np.abs(maxshift * np.random.ranf((1, Q))))
        hypinit[:Q] = np.log(w)
        hypinit[Q + np.arange(0, Q * D)] = np.log(m[:]).T
        hypinit[Q + Q * D + np.arange(0, Q * D)] = np.log(s[:]).T
        self.hyp = list(hypinit)
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/cov.py/SM.initSMhypers/swapped operands of `>`