def predict(self, x: np.ndarray) -> np.ndarray:
        """
        Perform prediction of the given classifier for a batch of inputs, potentially filtering suspicious input

        :param x: Input samples.
        :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
        """
        raw_predictions = self.predict_fn(x)

        if self.entropy_threshold is None or self.validation_data is None:  # pragma: no cover
            logger.warning("Mitigation has not been performed. Predictions may be unsafe.")
            return raw_predictions

        x_val = self.validation_data
        final_predictions = []

        for i, img in enumerate(x):
            # Randomly select samples from test set
            selected_indices = np.random.choice(np.arange(len(x_val)), self.num_samples)

            # Perturb the images by combining them
            perturbed_images = np.array([combine_images(img, x_val[idx]) for idx in selected_indices])

            # Predict on the perturbed images
            perturbed_predictions = self.predict_fn(perturbed_images)

            # Calculate normalized entropy
            normalized_entropy = np.sum(entropy(perturbed_predictions, base=2, axis=0)) / float(self.num_samples)

            # Abstain if entropy is below threshold
            if normalized_entropy <= self.entropy_threshold:
                final_predictions.append(self.abstain())
            else:
                final_predictions.append(raw_predictions[i])

        return np.array(final_predictions)

        Perform prediction of the given classifier for a batch of inputs, potentially filtering suspicious input

        :param x: Input samples.
        :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
        
art/estimators/poison_mitigation/strip/strip.py