mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-10-30 18:33:33 +00:00
Included open-source Accord.net library code natively to the solution given the deprecated state of that project. Accord.net will be supported inside Jube for own needs (such as upgrading to .Net 7+). Accord.net libraries modified to compile to .Net 6. Modified Accord.net libraries to better support Newtonsoft Json.net serialisation. Included annotations in the Accord.net libraries to house important dependency statistics. Serialised json can be used independently of Jube to recall a Neural Network. Removal of Binary Serializer totally as a precursor to the projects support of .Net 7+. Extensive bug fixing in crucial functions of Neural Network training and recall. While this part of the system remains in Alpha, it is substantially more fit for purpose.
62 lines
2.1 KiB
C#
62 lines
2.1 KiB
C#
// AForge Neural Net Library
|
|
// AForge.NET framework
|
|
// http://www.aforgenet.com/framework/
|
|
//
|
|
// Copyright © AForge.NET, 2007-2012
|
|
// [email protected]
|
|
//
|
|
|
|
namespace Accord.Neuro
|
|
{
|
|
using System;
|
|
using Accord.Compat;
|
|
|
|
/// <summary>
|
|
/// Activation layer.
|
|
/// </summary>
|
|
///
|
|
/// <remarks>Activation layer is a layer of <see cref="ActivationNeuron">activation neurons</see>.
|
|
/// The layer is usually used in multi-layer neural networks.</remarks>
|
|
///
|
|
[Serializable]
|
|
public class ActivationLayer : Layer
|
|
{
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ActivationLayer"/> class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="neuronsCount">Layer's neurons count.</param>
|
|
/// <param name="inputsCount">Layer's inputs count.</param>
|
|
/// <param name="function">Activation function of neurons of the layer.</param>
|
|
///
|
|
/// <remarks>The new layer is randomized (see <see cref="ActivationNeuron.Randomize"/>
|
|
/// method) after it is created.</remarks>
|
|
///
|
|
public ActivationLayer( int neuronsCount, int inputsCount, IActivationFunction function )
|
|
: base( neuronsCount, inputsCount )
|
|
{
|
|
// create each neuron
|
|
for ( int i = 0; i < neurons.Length; i++ )
|
|
neurons[i] = new ActivationNeuron( inputsCount, function );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set new activation function for all neurons of the layer.
|
|
/// </summary>
|
|
///
|
|
/// <param name="function">Activation function to set.</param>
|
|
///
|
|
/// <remarks><para>The methods sets new activation function for each neuron by setting
|
|
/// their <see cref="ActivationNeuron.ActivationFunction"/> property.</para></remarks>
|
|
///
|
|
public void SetActivationFunction( IActivationFunction function )
|
|
{
|
|
for ( int i = 0; i < neurons.Length; i++ )
|
|
{
|
|
( (ActivationNeuron) neurons[i] ).ActivationFunction = function;
|
|
}
|
|
}
|
|
}
|
|
}
|