'Apply the approximate feature map to X.
Parameters
X : {array-like, sparse matrix}, shape (n_samples, n_features)
New data, where n_samples in the number of samples
and n_features is the number of features.
Returns
X_new : array-like, shape (n_samples, n_components)'

def transform(self, X):

    check_is_fitted(self, 'random_weights_')
    X = check_array(X, accept_sparse='csr')
    projection = safe_sparse_dot(X, self.random_weights_)
    projection += self.random_offset_
    np.cos(projection, projection)
    projection *= (np.sqrt(2.0) / np.sqrt(self.n_components))
    return projection
