Exemplo n.º 1
0
        /// <summary>
        /// Compute the outputs for this layer given the input pattern. The output is
        /// also stored in the fire instance variable.
        /// </summary>
        /// <param name="pattern">The input pattern.</param>
        /// <returns>The output from this layer.</returns>
        public virtual INeuralData Compute(INeuralData pattern)
        {
            INeuralData result = (INeuralData)pattern.Clone();

            if (this.HasBias)
            {
                // apply the bias values
                for (int i = 0; i < this.biasWeights.Length; i++)
                {
                    result[i] = result[i] + this.biasWeights[i];
                }
            }

            // apply the activation function
            ActivationFunction.ActivationFunction(result.Data, 0, result.Data.Length);

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compute the outputs for this layer given the input pattern. The output is
        /// also stored in the fire instance variable.
        /// </summary>
        /// <param name="pattern">The input pattern.</param>
        /// <returns>The output from this layer.</returns>
        public virtual INeuralData Compute(INeuralData pattern)
        {

            INeuralData result = (INeuralData)pattern.Clone();

            if (this.HasBias)
            {
                // apply the bias values
                for (int i = 0; i < this.biasWeights.Length; i++)
                {
                    result[i] = result[i] + this.biasWeights[i];
                }
            }

            // apply the activation function
            ActivationFunction.ActivationFunction(result.Data, 0, result.Data.Length);

            return result;
        }