Ivankarez.NeuralNetworks 4.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ivankarez.NeuralNetworks --version 4.0.0                
NuGet\Install-Package Ivankarez.NeuralNetworks -Version 4.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="Ivankarez.NeuralNetworks" Version="4.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ivankarez.NeuralNetworks --version 4.0.0                
#r "nuget: Ivankarez.NeuralNetworks, 4.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 Ivankarez.NeuralNetworks as a Cake Addin
#addin nuget:?package=Ivankarez.NeuralNetworks&version=4.0.0

// Install Ivankarez.NeuralNetworks as a Cake Tool
#tool nuget:?package=Ivankarez.NeuralNetworks&version=4.0.0                

NeuralNetworks

Introducing a lightweight and specialized neural network library for C#, meticulously designed to complement evolutionary algorithms. Our library is optimized for the crucial task of computing forward passes within neural networks, without the overhead of built-in backpropagation or conventional learning algorithms.

Key Features:

  • Efficiency and Memory Optimization: Our neural network library prioritizes resource efficiency, minimizing memory usage and allocations. It achieves this by utilizing C# float arrays for inputs and outputs, while intelligently reusing arrays to enhance performance across successive passes.
  • Keras like API for a familiar interface.
  • No extra dependencies. Makes it easy to drop it into your Unity or C# project as a single DLL file.

Getting Started

Basic Usage

Creating a simple neural network with dense layers should be very similar if you are familiar with keras. You can reach all the functionality through the NN class from the Ivankarez.NeuralNetworks.Api namespace. This is the base class to declare your network. The NN api provides an easy way to access the capabilities of the library. You can use NN.Layers to create new layers, NN.Activations to access activation functions and so on. More of this in the Features section.

Sample code to create layered model with 3 dense layers. The node count of the last layer will determine the output size of the network. In this example we create a network with this configuration:

  • An input of size 3
  • A dense layer with 10 neurons
  • A dense layer with 3 neurons, using the Tanh activation
  • A dense layer with 2 neurons. Since this is the last layer, it means this network will have an output size of 2.
using Ivankarez.NeuralNetworks.Api;

var neuralNetwork = NN.Models.Layered(3,
        NN.Layers.Dense(10),
        NN.Layers.Dense(3, activation: NN.Activations.Tanh()),
        NN.Layers.Dense(2));

var result = neuralNetwork.FeedForward(new float[] {1, 2, 3});
Console.WriteLine($"Result: {string.Join(", ", result)}");

Demo Programs

  • Character classification trained with simple evolution: TODO

Features

This is a simple list of available features of this package. If you look for available parameters or default values, you can take a look at the corresponding API codes linked in the section headers.

Models

  • Layered Model

Layers

  • Dense Layer
  • Simple Recurrent Layer
  • 1 dim convolution layer
  • 2 dim convolution layer
  • 1 dim pooling layer (min, max, average, sum)
  • 2 dim pooling layer (min, max, average, sum)

Activations

  • Linear
  • Clamped linear
  • Tanh
  • Sigmoid
  • Relu
  • Leaky Relu

Initializers

  • Zeros
  • Constant
  • Uniform
  • Normal
  • Glorot uniform
  • Glorot normal

Contributions

All contributions are welcome. For a starting point it's quite easy to implement other activation functions and initializers. Also extending test coverage, or simplify tests can be a good starting point.

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 netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.

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
4.4.0 84 9/20/2024
4.3.0 254 11/17/2023
4.2.0 147 11/3/2023
4.1.0 163 10/24/2023
4.0.0 133 10/22/2023