Save and load a neural network¶
The function saveNN
allows to save the structure and the trained weights of a neural network to a csv file. The function loadNN
allows to load a saved neural network. This allows also to interchange neural network objects between python and matlab.
Save a neural network with saveNN()
¶
Python¶
-
pyrenn.
saveNN
(net, filename)¶ Saves a neural network object to a csv file
Parameters:
Example: Saving the neural network object net
to ‘C:nnmynetwork.csv’
pyrenn.saveNN(net,'C:\nn\mynetwork.csv')
Matlab¶
-
saveNN
(net, filename)¶ Saves a neural network object to a csv file
Parameters: - net (struct) – a pyrenn neural network object
- filename (string) – full or relative path of a csv file to save the neural network (filename = ‘\folder\file.csv’)
Example: Saving the neural network object net
to ‘C:nnmynetwork.csv’
saveNN(net,'C:\nn\mynetwork.csv')
Load a neural network with loadNN()
¶
Python¶
-
pyrenn.
loadNN
(filename)¶ Load a neural network object from a csv file
Parameters: filename (string) – full or relative path of a csv file which contains a saved pyrenn neural network (filename = ‘\folder\file.csv’) Returns: a pyrenn neural network object Return type: dict
Example: Load a neural network saved in ‘C:nnmynetwork.csv’ into net
net = pyrenn.loadNN('C:\nn\mynetwork.csv')
Matlab¶
-
loadNN
(filename)¶ Load a neural network object from a csv file
Parameters: - filename (string) – full or relative path of a csv file which contains a saved pyrenn neural network (filename = ‘\folder\file.csv’)
Returns: a pyrenn neural network object
Return type: dict
Example: Load a neural network saved in ‘C:nnmynetwork.csv’ into net
net = loadNN('C:\nn\mynetwork.csv')