def backdoor_examples(self, x_val: np.ndarray, y_val: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
        """
        Generate reverse-engineered backdoored examples using validation data

        :param x_val: validation data
        :param y_val: validation labels
        :return: a tuple containing (clean data, backdoored data, labels)
        """
        clean_data_list = []
        example_data_list = []
        example_labels_list = []

        for backdoored_label, mask, pattern in self.outlier_detection(x_val, y_val):
            data_for_class = np.copy(x_val[np.argmax(y_val, axis=1) == backdoored_label])
            labels_for_class = np.copy(y_val[np.argmax(y_val, axis=1) == backdoored_label])

            if len(data_for_class) == 0:
                logger.warning("No validation data exists for infected class: %s", str(backdoored_label))

            clean_data_list.append(np.copy(data_for_class))
            data_for_class = (1 - mask) * data_for_class + mask * pattern
            example_data_list.append(data_for_class)
            example_labels_list.append(labels_for_class)

        # If any backdoor examples were found, stack data into one array
        if example_data_list:
            clean_data = np.vstack(clean_data_list)
            example_data = np.vstack(example_data_list)
            example_labels = np.vstack(example_labels_list)
        else:
            clean_data = np.array(clean_data_list)
            example_data = np.array(example_data_list)
            example_labels = np.array(example_labels_list)

        return clean_data, example_data, example_labels

        Generate reverse-engineered backdoored examples using validation data

        :param x_val: validation data
        :param y_val: validation labels
        :return: a tuple containing (clean data, backdoored data, labels)
        
art/estimators/poison_mitigation/neural_cleanse/neural_cleanse.py