FotNET 2.1.0

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

// Install FotNET as a Cake Tool
#tool nuget:?package=FotNET&version=2.1.0                

FotNET

FotNET is a simple library for working with RECURRENT NEURAL NETWORKS, CONVOLUTION NEURAL NETWORKS and CLASSIC NEURAL NETWORKS like PERCEPTRON. The main part is that u can create ur own neural network without libraries that takes all work. This project is open source and u can see a code, download him and change every part what u need cuz it very simple to understand this prokject.

Introduction:


Importing:

First of all u should download this library and includ it into ur own project. U can do this with NUGET or MANUALY by downloading source code.

Using FotNET;

Using FotNET.NETWORK;


Creation:

For creating neural network class u need do SIMPLE steps:

  1. Create neural network object:

     Network netwok = new Network(layers);
    

1.1. Also, before we start, u need to choose a model of neural network. U can do this by creating a List of Layers:

	List<ILayer> layers = new List<ILayer> {
		new ConvolutionLayer(); // Input tensor get convolved by filters
		new ActivationLayer(); // Input tensor get activated
		new DropoutLayer();
		new PoolingLayer(); // Input tensor get pooled
		new ConvolutionLayer();
		new ActivationLayer();
		new DropoutLayer();
		new PoolingLayer();
		new FlattenLayer(); // Input tensor get converted to 1d tensor
		new PerceptronLayer(); // Input 1d tensor multiply with weights 
		new ActivationLayer();
		new DropoutLayer();
		new PerceptronLayer();
		new ActivationLayer();
		new SoftMaxLayer(); 
	}
	
	>> **OR**
	
	List<ILayer> layers = new List<ILayer> {
		new FlattenLayer();
		new RecurrentLayer();
		new SoftMaxLayer(); 
	}

1.1.1. Every layer needs a parametrs, that u should choose by ur self:

	new ConvolutionLayer(filterCount, filterHeight, filterWeight, filterDepth, weightInitialization, convolutionStride);
	// or
	new ConvolutionLayer(pathToFilter, convolutionStride); // path to filter is a path to ur custom filter. Example of custom filters u can find in the end of ReadMe.
	
	new ActivationLayer(activateFunction);
	new PoolingLayer(poolingType, poolingSize);
	new PerceptronLayer(size, sizeOfNextLayer, weightInitialization);
	new PerceptronLayer(size);
	new DropoutLayer(percentOfDropped);
	new RecurrentLayer(activationFunction, recurrencyType, hiddenLayerSize, weightInitialization);
	

1.1.1.1. Types of pooling u can find here:

	new MaxPooling();
	new MinPooling();
	new AveragePooling();

1.1.1.2. Variants of weight initialization:

	new HeInitialization(); // Usualy uses with ReLU, Leaky ReLU and Double Leaky ReLU
	new XavierInitialization(); // Also uses with Tanghensoid and Sighmoid
	new NormalizedXavierInitialization(); // Same with upper activation function, but normalized

1.2. After it u should choose one of ACTIVATION FUNCTIONS or create ur own, but dont forget add IFunction interface:

	new ReLu();
	new LeakyReLu();
	new DoubleLeakyReLu();
	new Sigmoid();
	new Tangensoid();
	new GeLu();
	new BinaryStep();
	new SoftPlus();
	new Identity();

ForwardFeed:
	network.ForwardFeed(image); // Put image or any tensor. 

Neural network after FORWARD FEED return a INDEX of a predicted class from classes that u add on last PERCEPTRON LAYER.

If predicted class is wrong, we going to Back Propagation.


BackPropagation:
	network.BackPropagation(expectedClass, expectedValue, learningRate); // Index of expected class and a value (usualy is 1)

If expected class is different that was predicted, we should use BACKPROPAGATION method.


Save and load weights:
Save:

All weights can be saved by using next method.

EXAMPLE:

	data = network.GetWeights();
Load:

For loading weights u should use same alghoritm.

EXAMPLE:

	network.LoadWeights(data);

Fitting and Testing
Fitting

Network class can be fitted and tested, and all what u need is a data set (list of data objects) and count of epochs (for fitting). Lets start on creation of data set.

	network.Fit(dataType, csvPath, csvConfig, epochCount, baseLearningRate);
	// dataType  -> Array or Tensor image
	// csvPath   -> path to csv file 
	// csvConfig -> rule that includes how should be processed csv file
	/*
	DataConfig csvConfig = new DataConfig() {
		StartRow          = 1, 
		InputColumnStart  = 1,
		InputColumnEnd    = 10,
		OutputColumnStart = 12,
		OutputColumnEnd   = 16,
		Delimiters        = new[] {";"}
	}
	*/
	// epochCount -> count of epochs
	// baseLearningRate -> start learning rate 

This is a implementaion of data set. "new Image()" as u can see - implementaion of image. First part where we can see "new double[,,]" very simple and means x,y and depth. Second part is answer for this data set unit. For example we should choose one of ten numbers, and we should create an array where index of needed element have vale equals 1.

Testing

After fitting u can test ur own model by using next method with test data set:

	double accuracy = network.Test(dataType, csvPath, csvConfig);

Examples

Custom filters

U should create a custom file.txt, after fill it like:

1 0 1
1 0 1
1 0 1

If u want add few filters, add other constructions and separate them by '//n':

1 0 1
1 0 1
1 0 1
/
0 0 0
1 1 1
0 0 0
/
1 0 0
0 1 0
0 0 1
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • 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
2.5.3 173 5/10/2023
2.5.2 124 5/1/2023
2.5.0 139 4/21/2023
2.4.0 123 4/13/2023
2.3.1 119 4/10/2023
2.3.0 129 4/9/2023
2.2.2 113 4/7/2023
2.2.1 121 4/6/2023
2.2.0 117 4/3/2023
2.1.0 240 4/1/2023
2.0.3 207 3/31/2023
2.0.2 238 3/29/2023
2.0.1 234 3/28/2023

fixed bugs with RNN (MTO method)