Пример #1
0
        /// <summary>
        /// Determine the significance of the neuron. The higher the return value,
        /// the more significant the neuron is.
        /// </summary>
        ///
        /// <param name="layer">The layer to query.</param>
        /// <param name="neuron">The neuron to query.</param>
        /// <returns>How significant is this neuron.</returns>
        public double DetermineNeuronSignificance(int layer,
                                                  int neuron)
        {
            _network.ValidateNeuron(layer, neuron);

            // calculate the bias significance
            double result = 0;

            // calculate the inbound significance
            if (layer > 0)
            {
                int prevLayer = layer - 1;
                int prevCount = _network
                                .GetLayerTotalNeuronCount(prevLayer);
                for (int i = 0; i < prevCount; i++)
                {
                    result += _network.GetWeight(prevLayer, i, neuron);
                }
            }

            // calculate the outbound significance
            if (layer < _network.LayerCount - 1)
            {
                int nextLayer = layer + 1;
                int nextCount = _network.GetLayerNeuronCount(nextLayer);
                for (int i = 0; i < nextCount; i++)
                {
                    result += _network.GetWeight(layer, neuron, i);
                }
            }

            return(Math.Abs(result));
        }