public void CreateSynapsisNetwork(InputLayer il) { int k = 0; for (int i = 0; i < Neurons.Length; i++) { for (int j = 0; j < il.Neurons.Length; j++) { Synapse temp = new Synapse(WeightRecords[k], il.Neurons[j], Neurons[i]); il.Neurons[j].AddSynapsis(temp); Neurons[i].AddSynapsis(temp, false); k++; } } }
public void Init_CreateSynapsisNetwork(InputLayer il) { Random rn = new Random(); for (int i = 0; i < Neurons.Length; i++) { for (int j = 0; j < il.Neurons.Length; j++) { float weightTemp = ((float)rn.Next(-10, 10)) / 10.0f; Synapse temp = new Synapse(weightTemp, il.Neurons[j], Neurons[i]); il.Neurons[j].AddSynapsis(temp); Neurons[i].AddSynapsis(temp, false); WeightRecords.Add(weightTemp); } } DataStream.Instance.WriteWBOnFile(WeightRecords, SynapsesFile); }
public Network(List <int> layers, bool init) { ILayer = new InputLayer(layers[0]); OLayer = new OutputLayer(layers[layers.Count - 1], "Weights/s_outputL.json", "Biases/b_outputL.json", init); HLayers = new List <HiddenLayer>(); for (int i = 1; i < layers.Count - 1; i++) { HLayers.Add(new HiddenLayer(layers[i], "Weights/s_layer" + i + ".json", "Biases/b_layer" + i + ".json", init)); } NumberOfLayers = HLayers.Count + 2; Costs = new List <float>(); OLayer.OutputAsDigits(); if (init) { Init_CreateSynapseNetworks(); } else { CreateSynapseNetworks(); } }