Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: how to save training datasets

Tags:

python

I have got training datasets, which are xtrain, ytrain, xtest and ytest. They are all numpy arrays. I want to save them together into a file, so that I can load them into workspace as done in keras for mnist.load_data:

(xtrain, ytrain), (xtest, ytest) = mnist.load_data(filepath)

In python, is there any way to save my training datasets into such a single file? Or is there any other appreciate methods to save them?

like image 560
jingweimo Avatar asked Dec 23 '22 17:12

jingweimo


1 Answers

You have a number of options:

  • npz
  • hdf5
  • pickle

Keras provides option to save models to hdf5. Also, note that out of the three, it's the only interoperable format.

like image 143
Lukasz Tracewski Avatar answered Dec 30 '22 16:12

Lukasz Tracewski