In real-world applications, an active learner will have a longer lifespan, and therefore it can be useful to save the current object on disk (or load it from disk). This process is called serialization (deserialization). While you could always rely on python’s own pickle library to achieve this, the PoolBasedActiveLearner class provides convenience methods for both serialization and deserialization.



Both and load save() take a string, a file, or a Path as input argument.


from small_text.active_learner import PoolBasedActiveLearner

active_learner = <...>   # care, this does not run;
                         # active_learner is assumed to be a trained active learner'active_leaner.pkl')

active_learner = PoolBasedActiveLearner.load('active_leaner.pkl')