SimpleNeuralNetwork<T>
Models & Types · AiDotNet.Prototypes
Simple 2-layer neural network for prototype validation. Demonstrates GPU acceleration through vectorized operations.
How It Works
This is a minimal neural network for Phase A prototype validation. It includes:
- Input layer → Hidden layer (with ReLU activation)
- Hidden layer → Output layer (linear)
- Backpropagation
- Adam optimizer integration
Constructors
| Constructor | Summary |
|---|---|
SimpleNeuralNetwork(int inputSize, int hiddenSize, int outputSize, int? seed) |
Initializes a new instance of the SimpleNeuralNetwork. |
Properties
| Property | Summary |
|---|---|
long ParameterCount { get; } |
Gets the total number of parameters in the network. |
Methods
| Method | Summary |
|---|---|
PrototypeVector<T> ComputeLossGradient(PrototypeVector<T> predicted, PrototypeVector<T> target) |
Computes gradient of MSE loss. |
PrototypeVector<T> Forward(PrototypeVector<T> input) |
Forward pass through the network. |
PrototypeVector<T> GetParameters() |
Gets all parameters as a single flattened vector. |
T ComputeLoss(PrototypeVector<T> predicted, PrototypeVector<T> target) |
Computes mean squared error loss. |
ValueTuple<PrototypeVector<T>, PrototypeVector<T>, PrototypeVector<T>, PrototypeVector<T>> Backward(PrototypeVector<T> outputGradient) |
Backward pass (computes gradients). |
void SetParameters(PrototypeVector<T> parameters) |
Sets all parameters from a single flattened vector. |