Interested in FANN C# for .NET Core? Show your support in this issue on the new FANN C# Core repository.
Fast Artificial Neural Network (FANN) Library is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks.
Cross-platform execution in both fixed and floating point are supported. It includes a framework for easy handling of training data sets. It is easy to use, versatile, well documented, and fast.
FANN C# is a wapper around FANN that lets you use the FANN libraries from C# on Windows.
All of the FANN neural_net and training_data C++ wrapper functionality is available along with the FANN parallel functions (for fannfloat and fanndouble).
I've changed from providing the dll's and zip's in the repository to providing them in GitHub releases. You'll have to go to the page of the realese you want (here is the latest release) and find and download the zip file with the dll's you want.
You have 4 options (note that debug FANN dlls are named fannfloatd.dll, fanndoubled.dll, and fannfixedd.dll):
#####For a network that supports float neural networks:
- Debug:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.Float.dll,fannfloatd.dll | FANNCSharp.Float.dll,fannfloatd.dll | 
| zip file with files | FANNCSharp.FloatDebugx86.zip | FANNCSharp.FloatDebugx64.zip | 
- Release:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.Float.dll,fannfloat.dll | FANNCSharp.Float.dll,fannfloat.dll | 
| zip file with files | FANNCSharp.FloatReleasex86.zip | FANNCSharp.FloatReleasex64.zip | 
- In your project add a reference to FANNCSharp.Float.dlland make surefannfloat[d].dllis in the same directory or is findable through your$PATH
#####For a network that supports double neural networks:
- Debug:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.Double.dll,fanndoubled.dll | FANNCSharp.Double.dll,fanndoubled.dll | 
| zip file with files | FANNCSharp.DoubleDebugx86.zip | FANNCSharp.DoubleDebugx64.zip | 
- Release:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.Double.dll,fanndouble.dll | FANNCSharp.Double.dll,fanndouble.dll | 
| zip file with files | FANNCSharp.DoubleReleasex86.zip | FANNCSharp.DoubleReleasex64.zip | 
- In your project add a reference to FANNCSharp.Double.dlland make surefanndouble[d].dllis in the same directory or is findable through your$PATH
#####For a network that supports fixed neural networks:
- Debug:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.Fixed.dll,fannfixedd.dll | FANNCSharp.Fixed.dll,fannfixedd.dll | 
| zip file with files | FANNCSharp.FixedDebugx86.zip | FANNCSharp.FixedDebugx64.zip | 
- Release:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.Fixed.dll,fannfixed.dll | FANNCSharp.Fixed.dll,fannfixed.dll | 
| zip file with files | FANNCSharp.FixedReleasex86.zip | FANNCSharp.FixedReleasex64.zip | 
- In your project add a reference to FANNCSharp.Fixed.dlland make surefannfixed[d].dllis in the same directory or is findable through your$PATH
#####For a dll that supports all 3 types of neural networks for easy switching:
- Debug:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.dll,fannfloatd.dll,fanndoubled.dll,fannfixedd.dll | FANNCSharp.dll,fannfloatd.dll,fanndoubled.dll,fannfixedd.dll | 
| zip file with files | FANNCSharp.FixedDebugx86.zip | FANNCSharp.FixedDebugx64.zip | 
- Release:
| x86 | x64 | |
|---|---|---|
| Files you need | FANNCSharp.dll,fannfloat.dll,fanndouble.dll,fannfixed.dll | FANNCSharp.dll,fannfloat.dll,fanndouble.dll,fannfixed.dll | 
| zip file with files | FANNCSharpReleasex86.zip | FANNCSharpReleasex64.zip | 
- Extract the zip files in your project or wherever you want them to be
- In your project add a reference to FANNCSharp.dlland make surefannfloat[d].dll,fanndouble[d].dllandfannfixed[d].dllare in the same directory or are findable through your$PATH
- To easily switch between the different types of networks do what the example projects do and add the following code to the top of your file:
#if FANN_FIXED
using FANNCSharp.Fixed;
using DataType = System.Int32;
#elif FANN_DOUBLE
using FANNCSharp.Double;
using DataType = System.Double;
#else
using FANNCSharp.Float;
using DataType = System.Single;
#endif
- Then add FANN_FIXED,FANN_DOUBLE, orFANN_FLOATto your conditional compilation symbols (Project -> Properties -> Build -> Conditional compilation symbols)
- If you write your code using DataTypein place of thefloat,doubleorintkeywords you would normally use then you can easily switch network types by changing the compilation symbol and recompiling (Note there are methods and properties that some network types support, but others don't, see the documentation for a full list of each type's supported functions).
- swig 3
- (Optional) 7zip command line
- First you'll want to clone the repository:
git clone https://github.com/joelself/FannCSharp.git
- Once that's finished, navigate to the VS2010 directory. In this case it would be .\fann\VS2010:
cd VS2010
- 
Open the solution fann.sln 
- 
From here you have 4 options (remember debug FANN dlls are named fannfloatd.dll,fanndoubled.dll, andfannfixedd.dll):
- 
Build a dll that supports float neural networks: 1. To do this build the FANNCSharp.Floatproject 2. The dlls will be in.\fann\bin\(Configuration)\(Platform)\3. You will needFANNCSharp.Float.dllas well asfannfloat[d].dll4. In your project add a reference toFANNCSharp.Float.dlland make surefannfloat[d].dllis in the same directory or is findable through your$PATH
- 
Build a dll that supports double neural networks: 1. To do this build the FANNCSharp.Doubleproject 2. The dlls will be in.\fann\bin\(Configuration)\(Platform)\3. You will needFANNCSharp.Double.dllas well asfanndouble[d].dll4. In your project add a reference toFANNCSharp.Double.dlland make surefanndouble[d].dllis in the same directory or is findable through your$PATH
- 
Build a dll that supports fixed neural networks: - To do this build the FANNCSharp.Fixedproject
- The dlls will be in .\fann\bin\(Configuration)\(Platform)\
- You will need FANNCSharp.Fixed.dllas well asfannfixed[d].dll
- In your project add a reference to FANNCSharp.Fixed.dlland make surefannfixed[d].dllis in the same directory or is findable through your$PATH
 
- To do this build the 
- 
Build a dll that supports all 3 types of neural networks for easy switching: - To do this build the FANNCSharpproject
- The dlls will be in .\fann\bin\(Configuration)\(Platform)\
- You will need FANNCSharp.dllas well asfannfloat[d].dll,fanndouble[d].dllandfannfixed[d].dll
- In your project add a reference to FANNCSharp.dlland make surefannfloat[d].dll,fanndouble[d].dlland fannfixed[d].dll are in the same directory or are findable through your$PATH
- To easily switch between the different types of networks follow the directions above in the From Binaries section
 
- To do this build the 
The main types, NeuralNet and TrainingData, are in the FANNCSharp.Float, FANNCSharp.Double, and FANNCSharp.Fixed namespaces. The types common to all types of NeuralNets are in the FANNCSharp namespace. For more detail on each of the types see the documentation.
FANN C#'s documentation can be found here. While the documentation for FANN itself can be found here.
To get started with FANN, go to the FANN help site, which will include links to all the available resources. FANN C# closely mirrors the C++ interfaces: neural_net and training_data.
For more information about FANN, please refer to the FANN website