Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
6 views
in AI and Deep Learning by (3.9k points)
edited by

I want to save the history to a file, in Keras I have model.fit

history = model.fit(Q_train, W_train,
                     batch_size
=batch_size,
                     nb_epoch
=nb_epoch,
                     validation_data=(Q_test, W_test))

2 Answers

0 votes
by (46k points)
edited by

You can save the model history by this:

with open('/trainHistoryDict', 'wb') as file_pi:
        pickle.dump(history.history, file_pi)

Happy Learning.  

Want to learn AI? Read this extensive artificial intelligence tutorial!

+4 votes
by (10.9k points)
edited by

You can try this code:

import json

history = model.fit(Q_train, W_train, epochs=5, batch_size=batch_size,validation_split=0.1)

with open('myfile.json', 'w') as file:

    json.dump(history.history, file)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...