Ann.koryakinp 1.0.0

dotnet add package Ann.koryakinp --version 1.0.0                
NuGet\Install-Package Ann.koryakinp -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: Ann.koryakinp, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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                

Ann

Machine Learning library for .NET Core.

Installation

PM> Install-Package Ann.koryakinp

Basic Usage

Configure a Network by defining the structure and meta-parametres

var layerConfig = new LayerConfiguration()
  .AddInputLayer(2)
  .AddHiddenLayer(5)
  .AddHiddenLayer(5)
  .AddOutputLayer(1);

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:

model.SaveModelToJson("network-configuration.json");
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: http://cs231n.github.io/neural-networks-3/#anneal

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.

Authors

Pavel koryakin koryakinp@koryakinp.com

License

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

Acknowledgments

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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 1,282 12/28/2017

Initial release