code: def replace_final_estimator(
      self, new_final_estimator, name: str = None
  ):
      self._clear_final_estimator_fit_vars(all=True)
      if hasattr(self._final_estimator, "fit"):
          self.steps[-1] = (
              self.steps[-1][0] if not name else name,
              new_final_estimator,
          )
      else:
          self.steps.append(
              (
                  name if name else "actual_estimator",
                  new_final_estimator,
              )
          )
  
imports: import platform
  import warnings
  from copy import deepcopy
  from inspect import signature
  import imblearn.pipeline
  import sklearn.pipeline
  from sklearn.base import clone
  from sklearn.utils import _print_elapsed_time
  from sklearn.utils.metaestimators import available_if
  from sklearn.utils.validation import check_memory
  from pycaret.utils._show_versions import _get_deps_info
  from pycaret.utils.generic import get_all_object_vars_and_properties, variable_return
label_desc: Use image node_id 23 for calling the Pipeline obj's underlying member method code with example usage: obj.replace_final_estimator(new_final_estimator, name) without return types