AForge.Neuro.Learning.SOMLearning.SOMLearning C# (CSharp) Method

SOMLearning() public method

Initializes a new instance of the SOMLearning class.

This constructor supposes that a square network will be passed for training - it should be possible to get square root of network's neurons amount.

Invalid network size - square network is expected.
public SOMLearning ( DistanceNetwork network ) : System
network DistanceNetwork Neural network to train.
return System
        public SOMLearning( DistanceNetwork network )
        {
            // network's dimension was not specified, let's try to guess
            int neuronsCount = network.Layers[0].Neurons.Length;
            int width = (int) Math.Sqrt( neuronsCount );

            if ( width * width != neuronsCount )
            {
                throw new ArgumentException( "Invalid network size." );
            }

            // ok, we got it
            this.network = network;
            this.width = width;
            this.height = width;
        }

Same methods

SOMLearning::SOMLearning ( DistanceNetwork network, int width, int height ) : System