SpatialPoolerLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Represents a spatial pooler layer inspired by hierarchical temporal memory (HTM) principles.

Inheritance: LayerBase<T> → SpatialPoolerLayer<T>

Implements: IShapeContract

For Beginners

This layer helps convert input data into a format that’s easier for neural networks to learn from.

Think of it like a translator that:

  • Takes dense input information (where many values can be active)
  • Converts it to a sparse representation (where only a few values are active)
  • Preserves the important patterns and relationships in the data

Benefits include:

  • Better handling of noisy or incomplete data
  • More efficient representation of information
  • Improved ability to recognize patterns

For example, when processing images, a spatial pooler might identify the most important features while ignoring background noise or variations that don’t matter for classification.

How It Works

A spatial pooler is a key component in HTM systems that converts input patterns into sparse distributed representations (SDRs). It maps input space to a new representation that captures the spatial structure of the input while maintaining semantic similarity. The spatial pooler creates these representations by selecting a small subset of active columns based on their connection strengths to the input.

Constructors

Constructor Summary
SpatialPoolerLayer(int columnCount, double sparsityThreshold) Initializes a new instance of the SpatialPoolerLayer class.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<ValueTuple<string, Tensor<T>>> GetRegisteredBuffers()
void Learn(Vector<T> input) Performs a learning step on the spatial pooler using the provided input.
void ResetState() Resets the internal state of the spatial pooler layer.
void UpdateParameters(T learningRate) Updates the parameters of the layer using the calculated gradients.