예제 #1
0
        /// <summary>
        ///     Determine how much the current neuron should be affected by training
        ///     based on its proximity to the winning neuron.
        /// </summary>
        /// <param name="currentNeuron"> THe current neuron being evaluated.</param>
        /// <param name="bestNeuron">The winning neuron.</param>
        /// <returns>The ratio for this neuron's adjustment.</returns>
        public double Function(int currentNeuron, int bestNeuron)
        {
            var d = new double[1];

            d[0] = currentNeuron - bestNeuron;
            return(_radial.Evaluate(d));
        }
예제 #2
0
        /// <summary>
        ///     Calculate the value for the multi RBF function.
        /// </summary>
        /// <param name="currentNeuron">The current neuron.</param>
        /// <param name="bestNeuron">The best neuron.</param>
        /// <returns>
        ///     A percent that determines the amount of training the current
        ///     neuron should get.Usually 100% when it is the bestNeuron.
        /// </returns>
        public double Function(int currentNeuron, int bestNeuron)
        {
            var vector        = new double[_displacement.Length];
            var vectorCurrent = TranslateCoordinates(currentNeuron);
            var vectorBest    = TranslateCoordinates(bestNeuron);

            for (var i = 0; i < vectorCurrent.Length; i++)
            {
                vector[i] = vectorCurrent[i] - vectorBest[i];
            }

            if (_hexagon)
            {
                var    row        = vector[1];
                var    col        = vector[0];
                double evenIndent = 1;
                var    oddIndent  = 2.5;
                var    indent     = row % 2 == 1 ? oddIndent : evenIndent;

                vector[1] = (int)(SQ75 + row * SQ75);
                vector[0] = (int)(indent + 3 * col);
            }


            return(_rbf.Evaluate(vector));
        }
예제 #3
0
        /// <summary>
        /// Calculate the value for the multi RBF function.
        /// </summary>
        /// <param name="currentNeuron">The current neuron.</param>
        /// <param name="bestNeuron">The best neuron.</param>
        /// <returns>A percent that determines the amount of training the current
        /// neuron should get.Usually 100% when it is the bestNeuron.
        /// </returns>
        public double Function(int currentNeuron, int bestNeuron)
        {
            double[] vector        = new double[_displacement.Length];
            int[]    vectorCurrent = TranslateCoordinates(currentNeuron);
            int[]    vectorBest    = TranslateCoordinates(bestNeuron);
            for (int i = 0; i < vectorCurrent.Length; i++)
            {
                vector[i] = vectorCurrent[i] - vectorBest[i];
            }

            if (_hexagon)
            {
                double row        = vector[1];
                double col        = vector[0];
                double evenIndent = 1;
                double oddIndent  = 2.5;
                double indent     = ((row % 2 == 1) ? oddIndent : evenIndent);

                vector[1] = (int)(SQ75 + (row * SQ75));
                vector[0] = (int)(indent + (3 * col));
            }


            return(_rbf.Evaluate(vector));
        }