C# Class AForge.Neuro.Network

Show file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Protected Properties

Property Type Description
inputsCount int
layers AForge.Neuro.Layer[]
layersCount int
output double[]

Public Methods

Method Description
Compute ( double input ) : double[]

Compute output vector of the network.

The actual network's output vecor is determined by layers, which comprise the layer - represents an output vector of the last layer of the network. The output vector is also stored in Output property.

The method may be called safely from multiple threads to compute network's output value for the specified input values. However, the value of Output property in multi-threaded environment is not predictable, since it may hold network's output computed from any of the caller threads. Multi-threaded access to the method is useful in those cases when it is required to improve performance by utilizing several threads and the computation is based on the immediate return value of the method, but not on network's output property.

Load ( System.Stream stream ) : Network

Load network from specified file.

Neural network is loaded from file using .NET serialization (binary formater is used).

Load ( string fileName ) : Network

Load network from specified file.

Neural network is loaded from file using .NET serialization (binary formater is used).

Randomize ( ) : void

Randomize layers of the network.

Randomizes network's layers by calling Layer.Randomize method of each layer.

Save ( System.Stream stream ) : void

Save network to specified file.

The neural network is saved using .NET serialization (binary formatter is used).

Save ( string fileName ) : void

Save network to specified file.

The neural network is saved using .NET serialization (binary formatter is used).

Protected Methods

Method Description
Network ( int inputsCount, int layersCount ) : System

Initializes a new instance of the Network class.

Protected constructor, which initializes inputsCount, layersCount and layers members.

Method Details

Compute() public method

Compute output vector of the network.

The actual network's output vecor is determined by layers, which comprise the layer - represents an output vector of the last layer of the network. The output vector is also stored in Output property.

The method may be called safely from multiple threads to compute network's output value for the specified input values. However, the value of Output property in multi-threaded environment is not predictable, since it may hold network's output computed from any of the caller threads. Multi-threaded access to the method is useful in those cases when it is required to improve performance by utilizing several threads and the computation is based on the immediate return value of the method, but not on network's output property.

public Compute ( double input ) : double[]
input double Input vector.
return double[]

Load() public static method

Load network from specified file.

Neural network is loaded from file using .NET serialization (binary formater is used).

public static Load ( System.Stream stream ) : Network
stream System.Stream Stream to load network from.
return Network

Load() public static method

Load network from specified file.

Neural network is loaded from file using .NET serialization (binary formater is used).

public static Load ( string fileName ) : Network
fileName string File name to load network from.
return Network

Network() protected method

Initializes a new instance of the Network class.
Protected constructor, which initializes inputsCount, layersCount and layers members.
protected Network ( int inputsCount, int layersCount ) : System
inputsCount int Network's inputs count.
layersCount int Network's layers count.
return System

Randomize() public method

Randomize layers of the network.
Randomizes network's layers by calling Layer.Randomize method of each layer.
public Randomize ( ) : void
return void

Save() public method

Save network to specified file.

The neural network is saved using .NET serialization (binary formatter is used).

public Save ( System.Stream stream ) : void
stream System.Stream Stream to save network into.
return void

Save() public method

Save network to specified file.

The neural network is saved using .NET serialization (binary formatter is used).

public Save ( string fileName ) : void
fileName string File name to save network into.
return void

Property Details

inputsCount protected property

Network's inputs count.
protected int inputsCount
return int

layers protected property

Network's layers.
protected Layer[],AForge.Neuro layers
return AForge.Neuro.Layer[]

layersCount protected property

Network's layers count.
protected int layersCount
return int

output protected property

Network's output vector.
protected double[] output
return double[]