FeedForwardNeuralNetwork<T>

Models & Types · AiDotNet.NeuralNetworks

Represents a Feed-Forward Neural Network (FFNN) for processing data in a forward path.

Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → VectorModelLayoutBase<T> → SequentialVectorModelLayoutBase<T> → FeedForwardNeuralNetwork<T>

For Beginners

Think of a Feed-Forward Neural Network like a series of information-processing stages arranged in a line. Data flows only forward through these stages, never backward. Each stage (or layer) processes the information and passes it to the next stage. This simple structure makes FFNNs great for many common tasks like classification (deciding which category something belongs to) or regression (predicting a numerical value).

How It Works

A Feed-Forward Neural Network is the simplest type of artificial neural network, where connections between nodes do not form a cycle. Information moves in only one direction – forward – from the input nodes, through the hidden nodes (if any), and to the output nodes.

Example

var architecture = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.Regression,
    inputSize: 10,
    outputSize: 2);
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 FeedForwardNeuralNetwork<float>(architecture))
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
FeedForwardNeuralNetwork() Initializes a new instance of the FeedForwardNeuralNetwork class.
FeedForwardNeuralNetwork(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, FeedForwardNeuralNetworkOptions options)

Properties

Property Summary
bool SupportsTraining { get; } Serializes feed-forward neural network-specific data to a binary writer.

Methods

Method Summary
ModelMetadata<T> GetModelMetadata() Retrieves metadata about the feed-forward neural network model.
Tensor<T> Forward(Tensor<T> input) Performs a forward pass through the network with the given input tensor.