Example #1
0
        /// <summary>
        /// 初始化网络参数
        /// </summary>
        private void InitialMatrix()
        {
            Random rnd = new Random(DateTime.Now.Second);

            for (int i = 0; i < Hidden_Layer_Count; i++)
            {
                for (int j = 0; j < Input_Layer_Count; j++)
                {
                    Input_Hiddene_Coefficient_Matrix.item[i, j] = (rnd.NextDouble() - 0.5) / (1 + 0.001 * i);
                }
            }

            for (int k = 0; k < Output_Layer_Count; k++)
            {
                for (int i = 0; i < Hidden_Layer_Count; i++)
                {
                    Hidden_Output_Coefficient_Matrix.item[k, i] = rnd.NextDouble() - 0.5;
                }
            }

            for (int i = 0; i < Hidden_Layer_Count; i++)
            {
                Hidden_Offset_Vector.item[i] = rnd.NextDouble() - 0.5;
            }

            for (int k = 0; k < Output_Layer_Count; k++)
            {
                Output_Offset_Vector.item[k] = rnd.NextDouble() - 0.5;
            }

            for (int k = 0; k < Hidden_Layer_Count; k++)
            {
                Logsig logsig = new Logsig();
                FirstNeuronVector[k] = logsig;
            }
            for (int k = 0; k < Output_Layer_Count; k++)
            {
                Pureline pureline = new Pureline();
                SecondNeuronVector[k] = pureline;
            }
        }
Example #2
0
        /// <summary>
        /// 初始化网络参数
        /// </summary>
        private void InitialMatrix()
        {
            Random rnd = new Random(DateTime.Now.Second);

            for (int i = 0; i < Hidden_Layer_Count; i++)
            {
                for (int j = 0; j < Input_Layer_Count; j++)
                {
                    Input_Hiddene_Coefficient_Matrix.item[i, j] = rnd.NextDouble() - 0.5;
                }
            }

            for (int k = 0; k < Output_Layer_Count; k++)
            {
                for (int i = 0; i < Hidden_Layer_Count; i++)
                {
                    Hidden_Output_Coefficient_Matrix.item[k, i] = rnd.NextDouble() - 0.5;
                }
            }

            //for (int i = 0; i < Hidden_Layer_Count; i++)
            //    Hidden_Offset_Vector.item[i] = rnd.NextDouble() - 0.5;

            for (int k = 0; k < Output_Layer_Count; k++)
            {
                Output_Offset_Vector.item[k] = rnd.NextDouble() - 0.5;
            }

            for (int k = 0; k < Hidden_Layer_Count; k++)
            {
                Legendre legendre = new Legendre();
                legendre.K           = k;
                FirstNeuronVector[k] = legendre;
            }
            for (int k = 0; k < Output_Layer_Count; k++)
            {
                Pureline pureline = new Pureline();
                SecondNeuronVector[k] = pureline;
            }
        }