Ann.koryakinp 1.0.0

.NET Standard 2.0
Install-Package Ann.koryakinp -Version 1.0.0
dotnet add package Ann.koryakinp --version 1.0.0
<PackageReference Include="Ann.koryakinp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ann.koryakinp --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ann.koryakinp, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ann.koryakinp as a Cake Addin
#addin nuget:?package=Ann.koryakinp&version=1.0.0

// Install Ann.koryakinp as a Cake Tool
#tool nuget:?package=Ann.koryakinp&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Machine Learning library for .NET Core.


PM> Install-Package Ann.koryakinp

Basic Usage

Configure a Network by defining the structure and meta-parametres

var layerConfig = new LayerConfiguration()

AddInputLayer(),AddOutputLayer() and AddHiddenLayer() add layers to the network configuration with specified number of neurons. A network must have one input, one output and any number of hidden layers.

var networkConfig = new NetworkConfiguration(layerConfig);
var model = new Network(networkConfig);

Train Model

double err1 = model.TrainModel(new List<double> { 0.25, 0.50 }, new List<double> { 1 });
double err2 = model.TrainModel(new List<double> { 0.75, 0.15 }, new List<double> { 0 });
double err3 = model.TrainModel(new List<double> { 0.60, 0.40 }, new List<double> { 1 });

First argument of the TrainModel method accepts input values. Second argument accepts output target values for a given training example. Weights and biases will be adjasted using Stochastic Gradient Descent with Back Propagation alghorith.

Use Model

List<double> output = model.UseModel(new List<double> { 0.35, 0.45 });

UseModel() accepts input values and performs forward-only pass, returns prediction of the model.

Save Model

After you done with trainig you can save the model in JSON file for a later use:

var model2 = new Network("network-configuration.json");

Advanced Configuration

Customizing activation function for agiven layer

AddHiddenLayer() and AddOutputLayer() have usefull overloads which allow for customization of the Activation function. Out of the box following activation functions supported: Logistic Sigmoid, Hyperbolic Tangent and Rectified Linear Unit. AddHiddenLayer(10, ActivatorType.ReluActivator) adds hidden layer with 10 neurons and Rectified Linear Unit activation function. If activation type is not provided the layer will use Logistic Sigmoid by default. For further customization an implementation of the IActivator interface can be provided.

Customizing Learning Rate, Momentum and Learning Rate Decay

If no custom configuration was provided a Network will fallback to 0.1 flat learning rate, with no momentum. There are two learning rate decay strategy supported out of the box: Exponential decay and Step decay. Step decay reduces the learning rate by some factor every few epochs. Exponential decay gradually reduces the learning rate in an exponential fashion. More info regarding the learning rate decy can be found here:

An example of custom Network Configuration:

NetworkConfiguration nc = new NetworkConfiguration(lc)
    Momentum = 0.9
    LearningRateDecayer = new StepDecayer(0.1, 0.8, 1000),

For further customization you can provide custom implementation of the ILearningRateDecayer interface.


Pavel koryakin


This project is licensed under the MIT License - see the for details.


Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 974 12/28/2017

Initial release