public void SetActivationFunction(NeuralActivationFunction _neuralActivationFunction) { switch (_neuralActivationFunction) { case NeuralActivationFunction.Sigmoid: actFunction = ActivationFunctions.Sigmoid; actFunctionDer = ActivationFunctions.SigmoidDer; break; case NeuralActivationFunction.Tanh: actFunction = ActivationFunctions.Tanh; actFunctionDer = ActivationFunctions.TanhDer; break; case NeuralActivationFunction.Relu: actFunction = ActivationFunctions.Relu; actFunctionDer = ActivationFunctions.ReluDer; break; case NeuralActivationFunction.LeakyRelu: actFunction = ActivationFunctions.LeakyRelu; actFunctionDer = ActivationFunctions.LeakyReluDer; break; default: break; } }
public Neuron(NeuralActivationFunction _neuralActivationFunction) { inputSynapses = new List <Synapse>(); outputSynapses = new List <Synapse>(); SetActivationFunction(_neuralActivationFunction); bias = NeuralNetwork.GetRandom(); }
public NeuralGeneNode(NeuralActivationFunction _neuralActivationFunction, int _nodeNumber, NeuralNodeType _nodeType) { inputSynapses = new List <NeuralGeneConnection>(); outputSynapses = new List <NeuralGeneConnection>(); SetActivationFunction(_neuralActivationFunction); nodeNumber = _nodeNumber; nodeType = _nodeType; bias = NeatNeuralNetwork.GetRandom(); }
public Neuron(NeuralActivationFunction _neuralActivationFunction, IEnumerable <Neuron> _inputNeurons) { inputSynapses = new List <Synapse>(); outputSynapses = new List <Synapse>(); SetActivationFunction(_neuralActivationFunction); bias = NeuralNetwork.GetRandom(); foreach (var inputNeuron in _inputNeurons) { var synapse = new Synapse(inputNeuron, this); inputNeuron.outputSynapses.Add(synapse); inputSynapses.Add(synapse); } }
public NeuralGeneNode AddHiddenNode(NeuralActivationFunction _neuralActivationFunctions) { if (HiddenLayers == null) { HiddenLayers = new List <NeuralGeneNode>(); } if (nodes == null) { nodes = new List <NeuralGeneNode>(); } NeuralGeneNode tmpNode = new NeuralGeneNode(_neuralActivationFunctions, nodes.Count + 1, NeuralNodeType.Hidden); HiddenLayers.Add(tmpNode); nodes.Add(tmpNode); return(tmpNode); }
public NeuralGeneNode AddOutputNode(NeuralActivationFunction _neuralActivationFunctions) { if (OutputLayer == null) { OutputLayer = new List <NeuralGeneNode>(); } if (nodes == null) { nodes = new List <NeuralGeneNode>(); } NeuralGeneNode tmpNode = new NeuralGeneNode(_neuralActivationFunctions, nodes.Count + 1, NeuralNodeType.Output); OutputLayer.Add(tmpNode); nodes.Add(tmpNode); return(tmpNode); }
public void AddInputsNode(int _inputSize, NeuralActivationFunction _neuralActivationFunctions) { if (InputLayer == null) { InputLayer = new List <NeuralGeneNode>(); } if (nodes == null) { nodes = new List <NeuralGeneNode>(); } for (int i = 0; i < _inputSize; i++) { NeuralGeneNode tmpNode = new NeuralGeneNode(_neuralActivationFunctions, i + 1, NeuralNodeType.Input); InputLayer.Add(tmpNode); nodes.Add(tmpNode); } }
public void AddOutputsNode(int _outputSize, NeuralActivationFunction _neuralActivationFunctions) { if (OutputLayer == null) { OutputLayer = new List <NeuralGeneNode>(); } if (nodes == null) { nodes = new List <NeuralGeneNode>(); } for (int i = 0; i < _outputSize; i++) { NeuralGeneNode tmpNode = new NeuralGeneNode(_neuralActivationFunctions, nodes.Count + 1, NeuralNodeType.Output); OutputLayer.Add(tmpNode); nodes.Add(tmpNode); } }