model_persistence.rst
1 Model Save & Load 2 ================= 3 4 PyOD takes a similar approach of sklearn regarding model persistence. 5 See `model persistence <https://scikit-learn.org/stable/modules/model_persistence.html>`_ for clarification. 6 7 In short, we recommend to use joblib or pickle for saving and loading PyOD models. 8 See `"examples/save_load_model_example.py" <https://github.com/yzhao062/pyod/blob/master/examples/save_load_model_example.py>`_ for an example. 9 In short, it is simple as below: 10 11 .. code-block:: python 12 13 from joblib import dump, load 14 15 # save the model 16 dump(clf, 'clf.joblib') 17 # load the model 18 clf = load('clf.joblib') 19 20 21 It is known that there are challenges in saving neural network models. 22 Check `#328 <https://github.com/yzhao062/pyod/issues/328#issuecomment-917192704>`_ 23 and `#88 <https://github.com/yzhao062/pyod/issues/88#issuecomment-615343139>`_ 24 for temporary workaround.