What is the standard way to persist a fitted scikit-learn estimator to disk?
Correct answer
B. Serialise it with joblib.dump and restore it with joblib.load
16 views
B. Serialise it with joblib.dump and restore it with joblib.load
16 views
joblib.dump serialises the fitted estimator along with every learned parameter and array, and joblib.load rebuilds it so predict can be called without retraining. scikit-learn deliberately exposes no save or load method on the estimators, because pickling the whole object is the supported route. A model restored this way must be read with the same library versions, since a changed attribute layout can break the unpickled object.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is B? Ask here and get an explanation.