RBFLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Represents a Radial Basis Function (RBF) layer for neural networks.
Inheritance: LayerBase<T> → RBFLayer<T>
Implements: IShapeContract
For Beginners
This layer works like a collection of specialized detectors.
Think of each neuron in this layer as a spotlight:
- Each spotlight has a specific location (center) in the input space
- Each spotlight has a certain brightness range (width)
- When input comes in, spotlights that are close to that input light up brightly
- Spotlights far from the input barely light up at all
For example, if you’re recognizing handwritten digits:
- One spotlight might be positioned to detect curved lines (like in “8”)
- Another might detect vertical lines (like in “1”)
- When a “3” comes in, the spotlights for curves light up strongly, while others stay dim
This layer is particularly good at classification problems and function approximation where the relationship between inputs and outputs is complex or non-linear.
How It Works
The RBF layer implements a type of artificial neural network that uses radial basis functions as activation functions. Each neuron in this layer has a center point in the input space and responds most strongly to inputs near that center. The response decreases as the distance from the center increases, controlled by the width parameter of each neuron.
Constructors
| Constructor | Summary |
|---|---|
RBFLayer(int inputSize, int outputSize, IRadialBasisFunction<T> rbf, IInitializationStrategy<T> initializationStrategy, RbfWidthInitialization widthInitialization, RbfCenterInitialization centerInitialization) |
Initializes a new instance of the RBFLayer class with specified dimensions and radial basis function. |
RBFLayer(int outputSize, IRadialBasisFunction<T> rbf, IInitializationStrategy<T> initializationStrategy, RbfWidthInitialization widthInitialization, RbfCenterInitialization centerInitialization) |
Lazy constructor: resolves inputSize from input.Shape[^1] on first Forward. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, string> GetParameterRoles() |
Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases). |
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
IReadOnlyList<Tensor<T>> GetTrainableParameters() |
Returns all trainable parameter tensors marked with [TrainableParameter]. |
void ClearGradients() |
Resets the internal state of the RBF layer. |
void ResetState() |
|
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) |
Replaces trainable parameter tensors (e.g., with ParameterBuffer views). |
void UpdateParameters(T learningRate) |
Updates the parameters of the RBF layer using the calculated gradients. |
void ZeroGrad() |
Clears all gradient fields discovered by convention ({paramName}Gradient). |