Saving models to disk
JLD.jl is the preferred way of saving
ScikitLearn.jl
models. If you also use Python models (via
@sk_import
), you will have to import
PyCallJLD as well.
using ScikitLearn
using ScikitLearn.Pipelines
using PyCall, JLD, PyCallJLD
@sk_import decomposition: PCA
@sk_import linear_model: LinearRegression
pca = PCA()
lm = LinearRegression()
pip = Pipeline([("PCA", pca), ("LinearRegression", lm)])
fit!(pip, ...) # fit to some dataset
JLD.save("pipeline.jld", "pip", pip)
# Load back the pipeline
pip = JLD.load("pipeline.jld", "pip")