def outlier_detection(self, x_val: np.ndarray, y_val: np.ndarray) -> list[tuple[int, np.ndarray, np.ndarray]]:
        """
        Returns a tuple of suspected poison labels and their mask and pattern

        :return: A list of tuples containing the class index, mask, and pattern for suspected labels
        """
        l1_norms = []
        masks = []
        patterns = []
        num_classes = self.nb_classes
        for class_idx in range(num_classes):
            # Assuming classes are indexed
            target_label = to_categorical([class_idx], num_classes).flatten()
            mask, pattern = self.generate_backdoor(x_val, y_val, target_label)
            norm = np.sum(np.abs(mask))
            l1_norms.append(norm)
            masks.append(mask)
            patterns.append(pattern)

        # assuming l1 norms would naturally create a normal distribution
        consistency_constant = 1.4826

        median = np.median(l1_norms)
        mad = consistency_constant * np.median(np.abs(l1_norms - median))
        # min_mad = np.abs(np.min(l1_norms) - median) / mad
        flagged_labels = []

        for class_idx in range(num_classes):
            anomaly_index = np.abs(l1_norms[class_idx] - median) / mad
            # Points with anomaly_index > 2 have 95% probability of being an outlier
            # Backdoor outliers show up as masks with small l1 norms
            if l1_norms[class_idx] <= median and anomaly_index > 2:
                logger.warning("Detected potential backdoor in class: %s", str(class_idx))
                flagged_labels.append(class_idx)

        return [(label, masks[label], patterns[label]) for label in flagged_labels]

        Returns a tuple of suspected poison labels and their mask and pattern

        :return: A list of tuples containing the class index, mask, and pattern for suspected labels
        
art/estimators/poison_mitigation/neural_cleanse/neural_cleanse.py