Skip to content

Can models be saved / loaded? #464

Answered by MaxHalford
jbone asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! Yes you can! There's an example in the FAQ:

>>> from river import ensemble
import pickle

model = ensemble.AdaptiveRandomForestClassifier()

with open('model.pkl', 'wb') as f:
    pickle.dump(model, f)
 
with open('model.pkl', 'rb') as f:
    model = pickle.load(f)

Each model is unit tested to make sure that it can be pickled. When you load the model, it will be in the exact same state as when you saved it.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by smastelini
Comment options

You must be logged in to vote
1 reply
@MaxHalford
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants