How to save final model using keras?

前端 未结 6 662
一整个雨季
一整个雨季 2020-11-28 07:01

I use KerasClassifier to train the classifier.

The code is below:

import numpy
from pandas import read_csv
from keras.models import Sequential
from k         


        
6条回答
  •  猫巷女王i
    2020-11-28 07:41

    The model has a save method, which saves all the details necessary to reconstitute the model. An example from the keras documentation:

    from keras.models import load_model
    
    model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
    del model  # deletes the existing model
    
    # returns a compiled model
    # identical to the previous one
    model = load_model('my_model.h5')
    

提交回复
热议问题