Introducing NeuralNet.NET: A simple to use .NET library for Artificial Neural Networks


Artificial Neural Networks (ANNs) are a cornerstone of modern machine learning, enabling systems to learn from data and make intelligent decisions. However, implementing ANNs from scratch can be complex and time-consuming. That's where NeuralNet.Net comes in—a simple, easy-to-use .NET library designed to help you create and train neural networks with minimal effort.
Getting Started
GitHub: adamstirtan/NeuralNet.NET: An extensible artificial neural network framework for .NET
NuGet: NuGet Gallery | NeuralNet.Net 1.0.0
Easy Setup
With NeuralNet.Net, you can quickly set up a neural network by specifying the number of layers and neurons. The library supports multiple activation functions, including Sigmoid, Tanh, and ReLU.
Customizable Activation Functions
NeuralNet.Net allows you to use built-in activation functions or define your own. This flexibility ensures that you can tailor the network to your specific needs.
Example Usage
Here's a quick example to demonstrate how easy it is to create, train, and use a neural network with NeuralNet.Net:
using NeuralNet.Net;
class Program
{
static void Main()
{
// Create a network with 2 input neurons, 2 hidden neurons, and 1 output neuron
var nn = new ANN(new int[] { 2, 2, 1 },
new ActivationFunctionType[] { ActivationFunctionType.Sigmoid, ActivationFunctionType.Sigmoid });
// Training data (XOR-like)
var trainingData = new List<(List<double>, List<double>)>
{
(new List<double> {0,0}, new List<double> {0}),
(new List<double> {0,1}, new List<double> {1}),
(new List<double> {1,0}, new List<double> {1}),
(new List<double> {1,1}, new List<double> {0}),
};
nn.Train(trainingData, epochs: 1000, learningRate: 0.1);
// Predict
var result = nn.Predict(new List<double> {1,1});
Console.WriteLine($"Output: {result[0]}");
}
}
Subscribe to my newsletter
Read articles from Adam Stirtan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
