NeuralNetwork class: add serialize() and deserialize()