def predict(self, x: np.ndarray, **kwargs) -> np.ndarray:
        """
        Perform prediction for a batch of inputs.

        :param x: Input samples.
        :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
        """
        import xgboost

        # Apply preprocessing
        x_preprocessed, _ = self._apply_preprocessing(x, y=None, fit=False)

        if isinstance(self._model, xgboost.Booster):
            train_data = xgboost.DMatrix(x_preprocessed, label=None)
            y_prediction = self._model.predict(train_data)
            if len(y_prediction.shape) == 1:
                y_prediction = to_categorical(labels=y_prediction, nb_classes=self.nb_classes)
        elif isinstance(self._model, xgboost.XGBClassifier):
            y_prediction = self._model.predict_proba(x_preprocessed)
        else:
            raise ValueError("Type of model not recognized.")

        # Apply postprocessing
        y_prediction = self._apply_postprocessing(preds=y_prediction, fit=False)

        return y_prediction

        Perform prediction for a batch of inputs.

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