Example #1
0
        public string Serialize(NeuralNetwork network)
        {
            var jsonObject = new NetworkJson();

            foreach (Layer layer in network.GetLayers())
            {
                var layerJson = new LayerJson()
                {
                    Weights    = layer.Weights.ToArray(),
                    Biases     = layer.Biases.ToArray(),
                    Activation = GetActivationName(layer.OutputActivation)
                };

                jsonObject.Add(layerJson);
            }

            return(JsonConvert.SerializeObject(jsonObject, Formatting.Indented));
        }
Example #2
0
 public void Add(LayerJson layer)
 {
     Layers.Add(layer);
 }