def compute_support(self, x, y):
        # type: (np.ndarray, np.ndarray) -> np.ndarray
        """
        Calculate the support for the rules.
        The support of each rule is a list of `n_classes` integers: [l1, l2, ...].
        Each integer represents the number of data of label i that is caught by this rule
        :param x: 2D np.ndarray (n_instances, n_features) should be categorical data, must be of type int
        :param y: 1D np.ndarray (n_instances, ) labels
        :return: a np.ndarray of shape (n_rules, n_classes)
        """
        caught_matrix = self.caught_matrix(x)
        if np.sum(caught_matrix.astype(np.int)) != x.shape[0]:
            raise RuntimeError("The sum of the support should equal to the number of instances!")
        support_summary = np.zeros((self.n_rules, self.n_classes), dtype=np.int)
        for i, support in enumerate(caught_matrix):
            support_labels = y[support]
            unique_labels, unique_counts = np.unique(support_labels, return_counts=True)
            if len(unique_labels) > 0 and np.max(unique_labels) > support_summary.shape[1]:
                # There occurs labels that have not seen in training
                pad_len = np.max(unique_labels) - support_summary.shape[1]
                support_summary = np.hstack((support_summary, np.zeros((self.n_rules, pad_len), dtype=np.int)))
            support_summary[i, unique_labels] = unique_counts
        return support_summary