public InputNeuron(ActivateFunction af, double inputValue, NeuronInputConnection[] _inputs) { act_func = af; InputValue = inputValue; SetInputConnections(_inputs); }
public InputNeuron(ActivateFunction af) { act_func = af; InputValue = 0.0; }
public InputNeuron(ActivateFunction af, double inputValue) { act_func = af; InputValue = inputValue; }
public NeuroNet(int numb_input_neurons, int numb_output_neurons, int[] numbNeuronsInLayers, bool[,] _connections, double[,] _weights, ActivateFunction af) { if(_connections.GetLength(0) != _connections.GetLength(1) || _weights.GetLength(0) != _weights.GetLength(1) || _connections.GetLength(0) != _weights.GetLength(0)) { throw new Exception("Invalid dimensions of connection or weight matrices"); } int countNeurons = _connections.GetLength(0); if (numb_input_neurons <= 0 || numb_input_neurons >= countNeurons) throw new Exception("Number of input neurons is out of range"); if (numb_output_neurons <= 0 || numb_output_neurons >= countNeurons) throw new Exception("Number of output neurons is out of range"); if(af == null) { throw new Exception("Not initialized activate function"); } if (numbNeuronsInLayers.GetLength(0) < 2 || numbNeuronsInLayers.GetLength(0) > countNeurons) throw new Exception("Invalid count of layers"); int sum = 0; foreach (int item in numbNeuronsInLayers) { if (item <= 0) throw new Exception("Must be at least one neuron in each layer"); sum += item; } if(sum != countNeurons) throw new Exception("Invalid count of neurons in layers"); neuronsInLayers = numbNeuronsInLayers; input_neurons = new InputNeuron[numb_input_neurons]; neurons = new Neuron[countNeurons]; output_neurons = new OutputNeuron[numb_output_neurons]; topology = new bool[countNeurons, countNeurons]; weights = new double[countNeurons, countNeurons]; evaluation_machine = new Queue<Queue<Neuron>>(); for (int i = 0; i < numb_input_neurons; i++) { input_neurons[i] = new InputNeuron(af); neurons[i] = input_neurons[i]; } for (int i = numb_input_neurons; i < countNeurons - numb_output_neurons; i++) { neurons[i] = new Neuron(af); } for (int i = 0; i < numb_output_neurons; i++) { output_neurons[i] = new OutputNeuron(af); neurons[i + countNeurons - numb_output_neurons] = output_neurons[i]; } for (int i = 0; i < countNeurons; i++) { Neuron cur = neurons[i]; for (int j = 0; j < countNeurons; j++) { topology[j, i] = false; if (_connections[j, i] == true) { topology[j, i] = true; weights[j, i] = _weights[j, i]; } } } setInputConnections(); isIterationsFinished = true; isWaveCameToOutputNeuron = false; }
public OutputNeuron(ActivateFunction af, NeuronInputConnection[] _inputs) { act_func = af; SetInputConnections(_inputs); }
public OutputNeuron(ActivateFunction af) { act_func = af; }
protected Neuron() { act_func = null; inputs = null; }
public Neuron(ActivateFunction af) { act_func = af; inputs = null; }