TabularPredictor.clone_for_deployment

TabularPredictor.clone_for_deployment(path: str, *, model: str = 'best', return_clone: bool = False, dirs_exist_ok: bool = False)[source]

Clone the predictor and all of its artifacts to a new location on local disk, then delete the clones artifacts unnecessary during prediction. This is ideal for use-cases where saving a snapshot of the predictor is desired before performing more advanced operations (such as fit_extra and refit_full).

Note that the clone can no longer fit new models, and most functionality except for predict and predict_proba will no longer work.

Identical to performing the following operations in order:

predictor_clone = predictor.clone(path=path, return_clone=True, dirs_exist_ok=dirs_exist_ok) predictor_clone.delete_models(models_to_keep=model, dry_run=False) predictor_clone.set_model_best(model=model, save_trainer=True) predictor_clone.save_space()

Parameters:
  • path (str) – Directory path the cloned predictor will be saved to.

  • model (str, default = 'best') – The model to use in the optimized predictor clone. All other unrelated models will be deleted to save disk space. Refer to the models_to_keep argument of predictor.delete_models for available options. Internally calls predictor_clone.delete_models(models_to_keep=model, dry_run=False)

  • return_clone (bool, default = False) – If True, returns the loaded cloned TabularPredictor object. If False, returns the local path to the cloned TabularPredictor object.

  • dirs_exist_ok (bool, default = False) – If True, will clone the predictor even if the path directory already exists, potentially overwriting unrelated files. If False, will raise an exception if the path directory already exists and avoids performing the copy.

Returns:

  • If return_clone == True, returns the loaded cloned TabularPredictor object.

  • If return_clone == False, returns the local path to the cloned TabularPredictor object.