IdentityActivation<T>

Models & Types · AiDotNet.ActivationFunctions

Implements the Identity activation function for neural networks.

Inheritance: ActivationFunctionBase<T> → IdentityActivation<T>

Implements: IFusedActivation

For Beginners

The Identity activation function is the simplest activation function - it returns exactly what you give it.

When you pass a value through this function:

  • Input of 2 ? Output of 2
  • Input of -3.5 ? Output of -3.5
  • And so on…

Think of it like a straight line on a graph where y = x.

While most neural networks use non-linear activation functions (like ReLU or Sigmoid) to model complex patterns, the Identity function can be useful in:

  • The output layer of regression problems (when predicting continuous values)
  • Testing or debugging neural networks
  • Certain network architectures where you want values to pass through unchanged

Example

using AiDotNet.ActivationFunctions;

var activation = new IdentityActivation<double>();
double y = activation.Activate(0.5);
Console.WriteLine($"IdentityActivation: f(0.5) = {y:F4}");

Constructors

Constructor Summary
IdentityActivation()

Methods

Method Summary
Matrix<T> Derivative(Vector<T> input) Calculates the derivative (gradient) of the Identity function for a vector of values.
T Activate(T input) Returns the input tensor unchanged — no allocation, preserves tape chain.
T Derivative(T input) Calculates the derivative (gradient) of the Identity function for a vector of values.
Tensor<T> Activate(Tensor<T> input) Returns the input tensor unchanged — no allocation, preserves tape chain.
Vector<T> Activate(Vector<T> input) Returns the input tensor unchanged — no allocation, preserves tape chain.