docstr: If True, only the best model and its ancestor models are saved in the outputted `predictor`. All other models are deleted.
      If you only care about deploying the most accurate predictor with the smallest file-size and no longer need any of the other trained models or functionality beyond prediction on new data, then set: `keep_only_best=True`, `save_space=True`.
      This is equivalent to calling `predictor.delete_models(models_to_keep='best', dry_run=False)` directly after `fit()`.
  If used with `refit_full` and `set_best_to_refit_full`, the best model will be the refit_full model, and the original bagged best model will be deleted.
      `refit_full` will be automatically set to 'best' in this case to avoid training models which will be later deleted.
docstr_tok: ["If","True",",","only","the","best","model","and","its","ancestor","models","are","saved","in","the","outputted","`","predictor","`",".","All","other","models","are","deleted",".","If","you","only","care","about","deploying","the","most","accurate","predictor","with","the","smallest","file-size","and","no","longer","need","any","of","the","other","trained","models","or","functionality","beyond","prediction","on","new","data",",","then","set",":","`","keep_only_best=True","`",",","`","save_space=True","`",".","This","is","equivalent","to","calling","`","predictor.delete_models","(","models_to_keep='best","'",",","dry_run=False",")","`","directly","after","`","fit","(",")","`",".","If","used","with","`","refit_full","`","and","`","set_best_to_refit_full","`",",","the","best","model","will","be","the","refit_full","model",",","and","the","original","bagged","best","model","will","be","deleted",".","`","refit_full","`","will","be","automatically","set","to","'best","'","in","this","case","to","avoid","training","models","which","will","be","later","deleted","."]
code: def keep_only_best(self, keep_only_best=True) -> ConfigBuilder:
      """
      If True, only the best model and its ancestor models are saved in the outputted `predictor`. All other models are deleted.
          If you only care about deploying the most accurate predictor with the smallest file-size and no longer need any of the other trained models or functionality beyond prediction on new data, then set: `keep_only_best=True`, `save_space=True`.
          This is equivalent to calling `predictor.delete_models(models_to_keep='best', dry_run=False)` directly after `fit()`.
      If used with `refit_full` and `set_best_to_refit_full`, the best model will be the refit_full model, and the original bagged best model will be deleted.
          `refit_full` will be automatically set to 'best' in this case to avoid training models which will be later deleted.
      """
      self.config["keep_only_best"] = keep_only_best
      return self
  
imports: from __future__ import annotations
  import copy
  from typing import Union
  from sklearn.base import BaseEstimator
  from autogluon.core.scheduler import scheduler_factory
  from autogluon.features import AutoMLPipelineFeatureGenerator
  from autogluon.tabular.configs.hyperparameter_configs import hyperparameter_config_dict
  from autogluon.tabular.configs.presets_configs import tabular_presets_dict
  from autogluon.tabular.trainer.model_presets.presets import MODEL_TYPES
label_desc: Use image node_id 19 for calling the ConfigBuilder obj's underlying member method code with example usage: obj.keep_only_best(keep_only_best) and returns: self