ExtremeLearningMachine<T>

Models & Types · AiDotNet.NeuralNetworks

Represents an Extreme Learning Machine (ELM), a type of feedforward neural network with a unique training approach.

Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → VectorModelLayoutBase<T> → ExtremeLearningMachine<T>

For Beginners

An Extreme Learning Machine is like a neural network on fast-forward.

Think of it like building a bridge:

  • Traditional neural networks carefully adjust every piece of the bridge (slow but thorough)
  • ELMs randomly set up most of the bridge, then only carefully adjust the final section
  • This approach is much faster but can still create a surprisingly strong bridge

The “extreme” part refers to its extremely fast training time. While traditional networks might take hours or days to train, ELMs can often be trained in seconds or minutes, making them useful for applications where training speed is critical.

How It Works

An Extreme Learning Machine is a special type of single-hidden-layer feedforward neural network that uses a non-iterative training approach. Unlike traditional neural networks that use backpropagation to adjust all weights, ELMs randomly assign the weights between the input and hidden layer and only train the weights between the hidden and output layer. This is done analytically using a pseudo-inverse operation rather than through iterative optimization, resulting in extremely fast training times while maintaining good generalization performance.

Example

var input = Tensor<float>.CreateRandom(new[] { 1, 10 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
    .ConfigureModel(new ExtremeLearningMachine<float>())
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
ExtremeLearningMachine() Initializes a new instance of the ExtremeLearningMachine class with the specified architecture and hidden layer size.
ExtremeLearningMachine(NeuralNetworkArchitecture<T> architecture, int hiddenLayerSize, ILossFunction<T> lossFunction, ExtremeLearningMachineOptions options)

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata() Gets metadata about the Extreme Learning Machine model.
Vector<T> GetParameterGradients() Trains the Extreme Learning Machine on a single batch of data.
void TrainWithRegularization(Tensor<T> input, Tensor<T> expectedOutput, double regularizationFactor) Trains the ELM using regularized least squares for improved generalization.