Encog.Neural.Networks.BasicNetwork.EnableConnection C# (CSharp) 메소드

EnableConnection() 공개 메소드

Enable, or disable, a connection.
public EnableConnection ( int fromLayer, int fromNeuron, int toNeuron, bool enable ) : void
fromLayer int The layer that contains the from neuron.
fromNeuron int The source neuron.
toNeuron int The target connection.
enable bool True to enable, false to disable.
리턴 void
        public void EnableConnection(int fromLayer,
                                     int fromNeuron, int toNeuron, bool enable)
        {
            double v = GetWeight(fromLayer, fromNeuron, toNeuron);

            if (enable)
            {
                if (!_structure.ConnectionLimited)
                {
                    return;
                }

                if (Math.Abs(v) < _structure.ConnectionLimit)
                {
                    SetWeight(fromLayer, fromNeuron, toNeuron,
                              RangeRandomizer.Randomize(-1, 1));
                }
            }
            else
            {
                if (!_structure.ConnectionLimited)
                {
                    SetProperty(TagLimit,
                                DefaultConnectionLimit);
                    _structure.UpdateProperties();
                }
                SetWeight(fromLayer, fromNeuron, toNeuron, 0);
            }
        }