BinarySpikingActivation<T>
Models & Types · AiDotNet.ActivationFunctions
Implements the Binary Spiking activation function for neural networks, particularly for spiking neural networks.
Inheritance: ActivationFunctionBase<T> → BinarySpikingActivation<T>
For Beginners
Binary Spiking activation models how real neurons in your brain generate electrical pulses.
Unlike standard activation functions that output continuous values, Binary Spiking:
- Outputs only 1 (spike/fire) or 0 (no spike)
- Neurons “fire” only when their input exceeds a threshold
- After firing, neurons typically have a “refractory period” before they can fire again
This activation creates the discrete, all-or-nothing behavior of biological neurons:
- Input below threshold ? Output = 0 (neuron remains silent)
- Input at or above threshold ? Output = 1 (neuron fires a spike)
Common uses include:
- Spiking Neural Networks (SNNs)
- Neuromorphic computing systems
- Models that process temporal information
- Energy-efficient neural networks for specialized hardware
Example
using AiDotNet.ActivationFunctions;
var activation = new BinarySpikingActivation<double>();
double y = activation.Activate(0.5);
Console.WriteLine($"BinarySpikingActivation: f(0.5) = {y:F4}");
Constructors
| Constructor | Summary |
|---|---|
BinarySpikingActivation() |
Initializes a new instance of the Binary Spiking activation function with default parameters. |
BinarySpikingActivation(T threshold, T derivativeSlope, T derivativeWidth) |
Initializes a new instance of the Binary Spiking activation function with custom parameters. |
Methods
| Method | Summary |
|---|---|
BinarySpikingActivation<T> WithThreshold(T newThreshold) |
Creates a new instance of the Binary Spiking activation with a different threshold. |
Matrix<T> Derivative(Vector<T> input) |
Calculates the derivative of the Binary Spiking function for a tensor input. |
T Activate(T x) |
Applies the Binary Spiking activation function to a tensor input. |
T Derivative(T x) |
Calculates the derivative of the Binary Spiking function for a tensor input. |
T GetThreshold() |
Gets the firing threshold value used by this activation function. |
Tensor<T> Activate(Tensor<T> input) |
Applies the Binary Spiking activation function to a tensor input. |
Tensor<T> Derivative(Tensor<T> input) |
Calculates the derivative of the Binary Spiking function for a tensor input. |
Vector<T> Activate(Vector<T> input) |
Applies the Binary Spiking activation function to a tensor input. |