Using Pickle to save modelsΒΆ

You can use pickle to save your model

from feature_selection import HarmonicSearch
from sklearn.datasets import load_breast_cancer
from six.moves import cPickle

dataset = load_breast_cancer()
X, y = dataset['data'], dataset['target_names'].take(dataset['target'])

hs = HarmonicSearch(random_state=0, make_logbook=True,
                    repeat=2)

hs.fit(X,y, normalize=True)

file = "HarmonicSearch"

f = open(file +'.save', 'wb')
cPickle.dump(hs, f, protocol=cPickle.HIGHEST_PROTOCOL)
f.close()

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery