TabularPredictor.persist

TabularPredictor.persist(models='best', with_ancestors=True, max_memory=0.4) List[str][source]

Persist models in memory for reduced inference latency. This is particularly important if the models are being used for online-inference where low latency is critical. If models are not persisted in memory, they are loaded from disk every time they are asked to make predictions.

Parameters:
  • models (list of str or str, default = 'best') – Model names of models to persist. If ‘best’ then the model with the highest validation score is persisted (this is the model used for prediction by default). If ‘all’ then all models are persisted. Valid models are listed in this predictor by calling predictor.model_names().

  • with_ancestors (bool, default = True) – If True, all ancestor models of the provided models will also be persisted. If False, stacker models will not have the models they depend on persisted unless those models were specified in models. This will slow down inference as the ancestor models will still need to be loaded from disk for each predict call. Only relevant for stacker models.

  • max_memory (float, default = 0.4) – Proportion of total available memory to allow for the persisted models to use. If the models’ summed memory usage requires a larger proportion of memory than max_memory, they are not persisted. In this case, the output will be an empty list. If None, then models are persisted regardless of estimated memory usage. This can cause out-of-memory errors.

Return type:

List of persisted model names.