code: def transform(self, X, mean=None, lenscale=None):
          
          mean = self._check_dim(X.shape[1], mean, paramind=0)
          lenscale = self._check_dim(X.shape[1], lenscale, paramind=1)
  
          VX = self._makeVX(X / lenscale)
          mX = X.dot(mean)[:, np.newaxis]
          Phi = np.hstack((np.cos(VX + mX), np.sin(VX + mX),
                           np.cos(VX - mX), np.sin(VX - mX))) / \
              np.sqrt(2 * self.n)
  
          return Phi
docs: Apply the spectral mixture component basis to X.
  
          Parameters
          ----------
          X: ndarray
              (N, d) array of observations where N is the number of samples, and
              d is the dimensionality of X.
          mean: ndarray, optional
              array of shape (d,) frequency means (one for each dimension of X).
              If not input, this uses the value of the initial mean.
          lenscale: ndarray, optional
              array of shape (d,) length scales (one for each dimension of X). If
              not input, this uses the value of the initial length scale.
  
          Returns
          -------
          ndarray:
              of shape (N, 4*nbases) where nbases is number of random bases to
              use, given in the constructor (to nearest larger two power).