/// <summary> /// Initalizes an ANeuron. /// Notes: /// -Initalizes Threshold to a Random Float. /// </summary> /// <param name="passedNumberOfWeights">The Number of Weights for the Neuron.</param> /// <param name="passedActivationFunction">The Activation Function for the Neuron</param> public ANeuron(uint passedNumberOfWeights, IActivationFunction passedActivationFunction) { this._Weights = GenerateWeights(passedNumberOfWeights); this._ActivationFunction = passedActivationFunction; InitalizeWeights(); this._Threshold = new NeuronThreshold(Config.RANDOM.NextFloat()); }
/// Initalizes an ANeuron. /// </summary> /// <param name="passedNumberOfWeights">The Number of Weights for the Neuron.</param> /// <param name="passedThreshold">The Threshold for the Neuron.</param> /// <param name="passedActivationFunction">The Activation Function for the Neuron</param> public ANeuron(uint passedNumberOfWeights, float passedThreshold, IActivationFunction passedActivationFunction) { this._Weights = GenerateWeights(passedNumberOfWeights); this._ActivationFunction = passedActivationFunction; InitalizeWeights(); this._Threshold = passedThreshold; }
public void SetNeuronLayerThresholds(INeuronLayerNeuronThresholds passedNeuronThresholds) { IEnumerator <INeuronThreshold> neuronThresholdsEnumerator = passedNeuronThresholds.Values; uint neuronIndex = 0; while (neuronThresholdsEnumerator.MoveNext()) { INeuronThreshold current = neuronThresholdsEnumerator.Current; INeuron neuron = this._Neurons[(int)neuronIndex++]; neuron.Threshold = current; } }
/// <summary> /// Calculates the Output for a given Input using the Sigmoid Function. /// </summary> /// <param name="passedInput">The Input.</param> /// <param name="passedThreshold">The Threshold.</param> /// <returns>The Output for the Sigmoid Function.</returns> public float CalculateOutput(float passedInput, INeuronThreshold passedThreshold) { float result = (float)(1 / (1 + Math.Exp((-passedInput) / passedThreshold.Value))); return(result); }
/// <summary> /// Calculates the Output for a given Input using the Sigmoid Function. /// </summary> /// <param name="passedInput">The Input.</param> /// <param name="passedThreshold">The Threshold.</param> /// <returns>The Output for the Sigmoid Function.</returns> public INeuronOutput CalculateOutput(INeuronActivationFunctionInput passedInput, INeuronThreshold passedThreshold) { float resultValue = (float)(1 / (1 + Math.Exp((-passedInput.Value) / passedThreshold.Value))); INeuronOutput result = new NeuronOutput(resultValue); return(result); }
/// <summary> /// Calculates the Output for a given Input using the Step Function. /// </summary> /// <param name="passedInput">The Input.</param> /// <param name="passedThreshold">The Threshold.</param> /// <returns>The Output for the Step Function.</returns> public float CalculateOutput(float passedInput, INeuronThreshold passedThreshold) { float result = (passedInput >= passedThreshold.Value) ? 1 : 0; return(result); }
public Neuron(INeuronWeights passedNeuronWeights, INeuronThreshold passedThreshold, INeuronActivationFunction passedActivationFunction) : base(passedNeuronWeights, passedThreshold, passedActivationFunction) { }
public Neuron(uint passedNumberOfWeights, INeuronThreshold passedThreshold, INeuronActivationFunction passedActivationFunction) : base(passedNumberOfWeights, passedThreshold, passedActivationFunction) { }
/// <summary> /// Calculates the Output for a given Input using the Step Function. /// </summary> /// <param name="passedInput">The Input.</param> /// <param name="passedThreshold">The Threshold.</param> /// <returns>The Output for the Step Function.</returns> public INeuronOutput CalculateOutput(INeuronActivationFunctionInput passedInput, INeuronThreshold passedThreshold) { float resultValue = (passedInput.Value >= passedThreshold.Value) ? 1 : 0; INeuronOutput result = new NeuronOutput(resultValue); return(result); }
public ANeuron(INeuronWeights passedNeuronWeights, INeuronThreshold passedThreshold, INeuronActivationFunction passedActivationFunction) { this.Weights = passedNeuronWeights; this._ActivationFunction = passedActivationFunction; this.Threshold = passedThreshold; }
public ANeuron(uint passedNumberOfWeights, INeuronThreshold passedThreshold, INeuronActivationFunction passedActivationFunction) { this._Weights = GenerateWeights(passedNumberOfWeights); this._ActivationFunction = passedActivationFunction; this._Threshold = passedThreshold; }