def clone_for_refitting(
        self,
    ) -> "XGBoostClassifier":
        """
        Create a copy of the estimator that can be refit from scratch. Only supported for models of type XGBClassifier.

        :return: new estimator.
        :raises `NotImplementedError`: This method is not supported for Booster objects.
        """
        import xgboost

        if isinstance(self._model, xgboost.XGBClassifier):
            params = self.get_params()
            del params["model"]
            internal_params = self._model.get_params()
            new_classifier = xgboost.XGBClassifier()
            new_classifier.set_params(**internal_params)
            new_estimator = XGBoostClassifier(new_classifier)
            new_estimator.set_params(**params)
            return new_estimator

        raise NotImplementedError

        Create a copy of the estimator that can be refit from scratch. Only supported for models of type XGBClassifier.

        :return: new estimator.
        :raises `NotImplementedError`: This method is not supported for Booster objects.
        
art/estimators/classification/xgboost.py