SQRBFActivation<T>

Models & Types · AiDotNet.ActivationFunctions

Implements the Squared Radial Basis Function (SQRBF) activation function.

Inheritance: ActivationFunctionBase<T> → SQRBFActivation<T>

Implements: IFusedActivation

For Beginners

The Squared Radial Basis Function (SQRBF) is an activation function that produces a bell-shaped curve. Unlike functions like ReLU or Sigmoid that are used in standard neural networks, SQRBF is commonly used in Radial Basis Function Networks (RBFNs).

Think of SQRBF like a “proximity detector” - it gives its highest output (1.0) when the input is exactly 0, and progressively smaller outputs as the input moves away from 0 in either direction (positive or negative). The ß parameter controls how quickly the output drops off as you move away from 0:

  • A larger ß makes the bell curve narrower (drops off quickly)
  • A smaller ß makes the bell curve wider (drops off slowly)

This is useful in machine learning when you want to measure how close an input is to a specific reference point.

How It Works

The SQRBF activation function is defined as f(x) = exp(-ß * x²), where ß is a parameter that controls the width of the Gaussian bell curve. This function outputs values between 0 and 1, with the maximum value of 1 occurring when the input is 0, and values approaching 0 as the input moves away from 0 in either direction.

Example

using AiDotNet.ActivationFunctions;

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

Constructors

Constructor Summary
SQRBFActivation(double beta) Initializes a new instance of the SQRBFActivation class with the specified beta parameter.

Methods

Method Summary
T Activate(T input) Applies SQRBF to a tensor via engine primitives so the gradient tape records every step.
T Derivative(T input) Calculates the derivative of the SQRBF function for a given input value.
Tensor<T> Activate(Tensor<T> input) Applies SQRBF to a tensor via engine primitives so the gradient tape records every step.