Ejemplo n.º 1
0
        public NetWork(int inputPopulation, int middlePopulation, int outputPopulation, double learningRate, double momentum)
        {
            Inputs = new InputNode[inputPopulation];
            for (int i = 0; i < Inputs.Count(); i++)
            {
                Inputs[i] = new InputNode();
            }

            Middles = new MiddleNode[middlePopulation];
            for (int j = 0; j < Middles.Count(); j++)
            {
                Middles[j] = new MiddleNode(learningRate, momentum);
            }

            Outputs = new OutputNode[outputPopulation];
            for (int h = 0; h < Outputs.Count(); h++)
            {
                Outputs[h] = new OutputNode(learningRate, momentum);
            }

            Arcs = new Arc[(inputPopulation * middlePopulation) + (middlePopulation * outputPopulation)];
            for (int k = 0; k < Arcs.Count(); k++)
            {
                Arcs[k] = new Arc();
            }

            int ii = 0;

            for (int jj = 0; jj < Inputs.Count(); jj++)
            {
                for (int kk = 0; kk < Middles.Count(); kk++)
                {
                    Inputs[jj].Connect(Middles[kk], Arcs[ii++]);
                }
            }

            for (int jj = 0; jj < Middles.Count(); jj++)
            {
                for (int kk = 0; kk < Outputs.Count(); kk++)
                {
                    Middles[jj].Connect(Outputs[kk], Arcs[ii++]);
                }
            }
        }
Ejemplo n.º 2
0
        public NetWork(int inputPopulation, int middlePopulation, int outputPopulation, double learningRate, double momentum)
        {
            Inputs = new InputNode[inputPopulation];
            for (int i = 0; i < Inputs.Count(); i++)
            {
                Inputs[i] = new InputNode();
            }

            Middles = new MiddleNode[middlePopulation];
            for (int j = 0; j < Middles.Count(); j++)
            {
                Middles[j] = new MiddleNode(learningRate, momentum);
            }

            Outputs = new OutputNode[outputPopulation];
            for (int h = 0; h < Outputs.Count(); h++)
            {
                Outputs[h] = new OutputNode(learningRate, momentum);
            }

            Arcs = new Arc[(inputPopulation * middlePopulation) + (middlePopulation * outputPopulation)];
            for (int k = 0; k < Arcs.Count(); k++)
            {
                Arcs[k] = new Arc();
            }

            int ii = 0;
            for (int jj = 0; jj < Inputs.Count(); jj++)
            {
                for (int kk = 0; kk < Middles.Count(); kk++)
                {
                    Inputs[jj].Connect(Middles[kk], Arcs[ii++]);
                }
            }

            for (int jj = 0; jj < Middles.Count(); jj++)
            {
                for (int kk = 0; kk < Outputs.Count(); kk++)
                {
                    Middles[jj].Connect(Outputs[kk], Arcs[ii++]);
                }
            }
        }