0

I've got a problem by serializing a neuronal Network to Json, I also save this Network to an Azure Table Storage (also json). This problem might cause even in other cases.

Short structure:
The Neuronal Network Class have a List of NeuronLayers, each Neuron Layer has his List of Neurons. The Neurons have a List of Connections, each Connection refers a Neuron (Entry Neuron) from the Layer before.

Problem:
When I Serialize the Neuronal Network and deserialize it, the Connection loses the reference to the entry neuron. The Json Deserializer just creating a new Neuron instead of referring the specified entry neuron. So the problem, in short, is that object references get lost on serialization.

I´ve also built a method to reference the entry neurons, but this is not a good way of doing, and I don't know why but it provides less performance than before serialization.

So did Anybody know how to save an object without losing his references to other serialized objects? I think a binary formatter could handle this...

Thanks for Future Advice!!

Adam Miklosi
  • 764
  • 5
  • 18
  • 28
Desiigner
  • 59
  • 1
  • 9
  • What JSON serializer are you using? – dbc Dec 05 '18 at 17:37
  • If you are using Json.NET you might be able to use [`PreserveReferencesHandling.Objects`](http://www.newtonsoft.com/json/help/html/PreserveReferencesHandlingObject.htm), see [What is the difference between PreserveReferencesHandling and ReferenceLoopHandling in Json.Net?](https://stackoverflow.com/q/23453977). But if your neural network is implemented as a linked list you may encounter a stack overflow, see [JSON.NET StackOverflowException while serialization](https://stackoverflow.com/a/41841581/3744182) for a possible workaround. To answer your question fully we need a [mcve]. – dbc Dec 05 '18 at 18:05

0 Answers0