joblib
noun
say it: “JOB-lib” /ˈdʒɑbˌlɪb/
A Python package used to save trained machine learning models to files and load them back.
What is joblib?
joblib is a Python package that scikit-learn uses and recommends for saving models: joblib.dump(model, "model.joblib") writes a fitted model to a file, and joblib.load() reads it back, ready to predict. As with pickle,
only load files you trust, with the same library versions.
import joblib
from sklearn.linear_model import LinearRegression
model = LinearRegression().fit([[60], [70], [80]], [20, 40, 60])
joblib.dump(model, "lemonade.joblib")
print(joblib.load("lemonade.joblib").predict([[75]])) # [50.]
In a sentence
- “The web app used joblib to load the model when it started.”
- “joblib saved the fitted pipeline as model.joblib.”
Level: Journeyman · More Python terms at this level
Updated