OutputNeuron[] denseOutputLayer(int numberOfNeurons, int numberOfInputOfEachNeuron, double learningRate = 1, string layerName = "outputNeuron") { OutputNeuron[] on = new OutputNeuron[numberOfNeurons]; for (int c = 0; c < numberOfNeurons; c++) { on [c] = new OutputNeuron(numberOfInputOfEachNeuron, layerName + c.ToString(), learningRate); } return(on); }
public OutputLayer(int size, Network n) : base(size, n) { OutputNeuron[] InputNeurons = new OutputNeuron[size]; for (int i = 0; i < size; i++) { InputNeurons[i] = new OutputNeuron(this); InputNeurons[i].name = "HiddenNeuron " + i; } this.neurons = InputNeurons; }
ParameterList <double> getInputList(HiddenNeuron[] hiddenLayer, OutputNeuron nextNeuron) { ParameterList <double> list = new ParameterList <double> (hiddenLayer.Length); for (int c = 0; c < list.Length; c++) { list [c] = hiddenLayer [c].Output(c, nextNeuron); } return(list); }
private void CreateOutputLayer() { var outputNeurons = new Neuron[Topology.OutputCount]; var preLastLayer = Layers[Topology.TotalLayersCount - 2]; for (int i = 0; i < Topology.OutputCount; i++) { var neuron = new OutputNeuron(preLastLayer.NeuronsCountInLayer, NeuronType.Output); outputNeurons[i] = neuron; } var outputLayer = new Layer(outputNeurons, NeuronType.Output); Layers[Topology.TotalLayersCount - 1] = outputLayer; }
internal IEnumerable <IOutputNeuron> BuildOutputNeurons(IEnumerable <INeuron> prevLayer, ushort count, ActivationTypes type) { var tempOutputLayer = new List <IOutputNeuron>(count); for (int i = 0; i < count; i++) { var neuron = new OutputNeuron(type); tempOutputLayer.Add(neuron); foreach (var inNeuron in prevLayer) { ConnectAxon(inNeuron, neuron, count); } } ((List <IOutputNeuron>) this.OutputNeurons).AddRange(tempOutputLayer); return(tempOutputLayer); }
private void CreateNeurons(ushort[] layerSizes, ITransferFunction[] transferFunctions) { if (layerSizes.Length != transferFunctions.Length) { throw new ArgumentException("Cannot make a network with these parameters."); } if (transferFunctions[0] != null) { throw new ArgumentException("Input layer transfer function must be null."); } Neurons = new Neuron[layerSizes.Length][]; for (byte l = 0; l < layerSizes.Length; l++) { // creates neurons in the input layer if (l == 0) { Neurons[l] = new InputNeuron[layerSizes[l]]; for (ushort i = 0; i < layerSizes[l]; i++) { Neurons[l][i] = new InputNeuron(transferFunctions[l]); } } // creates neurons in the hidden layer(s) else if (l < layerSizes.Length - 1) { Neurons[l] = new HiddenNeuron[layerSizes[l]]; for (ushort i = 0; i < layerSizes[l]; i++) { Neurons[l][i] = new HiddenNeuron(transferFunctions[l]); } } // creates neurons in the output layer else { Neurons[l] = new OutputNeuron[layerSizes[l]]; for (ushort i = 0; i < layerSizes[l]; i++) { Neurons[l][i] = new OutputNeuron(transferFunctions[l]); } } } }
public String GetName() { if (OutputNeuron != null) { if (InputNeuron != null) { return(String.Format("Source: {0}, Target: {1}", InputNeuron.GetName(), OutputNeuron.GetName())); } else { return(String.Format("Input layer: {0}, Target: {1}", InputIndex, OutputNeuron.GetName())); //input } } else { return(""); } }