How to Save and Load Data Transforms: how to save a model and data preparation object to file for later use Flashcards

1
Q

WHAT DOES MAKE_BLOBS () FUNCTION DO? P350

A

It’s used for creating a synthetic dataset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

DOES MAKE_BLOBS () HAVE A “RANDOM_STATE” PARAMETER? P350

A

Yes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

HOW DO WE SAVE A MODEL AND ITS SCALER USING PICKLE? CODE P351

A
from pickle import dump
… after fitting the scaler and the model to the train set…
# save the model
dump(model, open('model.pkl', 'wb'))
# save the scaler
dump(scaler, open('scaler.pkl', 'wb')) 
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

HOW DO WE LOAD A MODEL AND ITS SCALER USING PICKLE? CODE P352

A
from pickle import load
# load the model
model = load(open('model.pkl', 'rb'))
# load the scaler
scaler = load(open('scaler.pkl', 'rb'))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly