Beispiel #1
0
        public MLP(int[] counts, int input)
        {
            mlp = new List<List<INeuron>>();

            //bemeneti reteg
            List<INeuron> inputlayer = new List<INeuron>();
            for (int i = 0; i < input; ++i)
            {
                InputNeuron n = new InputNeuron();
                inputlayer.Add(n);
            }
            mlp.Add(inputlayer);

            //rejtett retegek
            int layernum = 0;
            foreach (int count in counts)
            {
                List<INeuron> layer = new List<INeuron>();
                for (int i = 0; i < count; ++i)
                {
                    Neuron n = new Neuron((layernum < counts.Length - 1));
                    //elozo reteg osszes neuronja bemenet
                    foreach (INeuron n2 in mlp[mlp.Count-1])
                    {
                        n.AddInputNeuron(n2);
                    }
                    layer.Add(n);
                }
                mlp.Add(layer);
                layernum++;
            }
        }
Beispiel #2
0
        public MLP(int[] counts, int input)
        {
            mlp = new List <List <INeuron> >();

            //bemeneti reteg
            List <INeuron> inputlayer = new List <INeuron>();

            for (int i = 0; i < input; ++i)
            {
                InputNeuron n = new InputNeuron();
                inputlayer.Add(n);
            }
            mlp.Add(inputlayer);

            //rejtett retegek
            int layernum = 0;

            foreach (int count in counts)
            {
                List <INeuron> layer = new List <INeuron>();
                for (int i = 0; i < count; ++i)
                {
                    Neuron n = new Neuron((layernum < counts.Length - 1));
                    //elozo reteg osszes neuronja bemenet
                    foreach (INeuron n2 in mlp[mlp.Count - 1])
                    {
                        n.AddInputNeuron(n2);
                    }
                    layer.Add(n);
                }
                mlp.Add(layer);
                layernum++;
            }
        }
Beispiel #3
0
        public void AddNeuron(int layer)
        {
            Neuron n = new Neuron(true);

            foreach (INeuron n2 in mlp[layer - 1])
            {
                n.AddInputNeuron(n2);
            }
            mlp[layer].Add(n);
            foreach (INeuron n2 in mlp[layer + 1])
            {
                ((Neuron)n2).AddInputNeuron(n);
            }
        }
Beispiel #4
0
        public MLP(MLP copyInstance)
        {
            mlp = new List <List <INeuron> >();
            List <INeuron> inputlayer = new List <INeuron>();

            for (int i = 0; i < copyInstance.mlp[0].Count; ++i)
            {
                InputNeuron n = new InputNeuron();
                inputlayer.Add(n);
            }
            mlp.Add(inputlayer);

            int layernum = 0;

            for (int i = 1; i < copyInstance.mlp.Count; ++i)
            {
                List <INeuron> layer = new List <INeuron>();
                for (int i2 = 0; i2 < copyInstance.mlp[i].Count; ++i2)
                {
                    Neuron n = new Neuron(((Neuron)copyInstance.mlp[i][i2]).nonlinear);
                    layer.Add(n);
                    //elozo reteg osszes neuronja bemenet
                    foreach (INeuron n2 in mlp[i - 1])
                    {
                        n.AddInputNeuron(n2);
                    }
                    //sulyok atmasolasa
                    int i3 = 0;
                    foreach (NeuronInput ni in n.inputs)
                    {
                        ni.w = ((Neuron)copyInstance.mlp[i][i2]).inputs[i3].w;
                        ++i3;
                    }
                }
                mlp.Add(layer);
                layernum++;
            }
        }
Beispiel #5
0
        public MLP(MLP copyInstance)
        {
            mlp = new List<List<INeuron>>();
            List<INeuron> inputlayer = new List<INeuron>();
            for (int i = 0; i < copyInstance.mlp[0].Count; ++i)
            {
                InputNeuron n = new InputNeuron();
                inputlayer.Add(n);                
            }
            mlp.Add(inputlayer);

            int layernum = 0;
            for (int i = 1; i < copyInstance.mlp.Count; ++i)
            {
                List<INeuron> layer = new List<INeuron>();
                for (int i2 = 0; i2 < copyInstance.mlp[i].Count; ++i2)
                {
                    Neuron n = new Neuron(((Neuron)copyInstance.mlp[i][i2]).nonlinear);
                    layer.Add(n);
                    //elozo reteg osszes neuronja bemenet
                    foreach (INeuron n2 in mlp[i - 1])
                    {
                        n.AddInputNeuron(n2);                        
                    }                    
                    //sulyok atmasolasa
                    int i3=0;
                    foreach (NeuronInput ni in n.inputs)
                    {
                        ni.w = ((Neuron)copyInstance.mlp[i][i2]).inputs[i3].w;
                        ++i3;
                    }                    
                }
                mlp.Add(layer);
                layernum++;
            }
        }
Beispiel #6
0
 public void AddNeuron(int layer)
 {
     Neuron n = new Neuron(true);
     foreach (INeuron n2 in mlp[layer - 1])
     {
         n.AddInputNeuron(n2);
     }
     mlp[layer].Add(n);
     foreach (INeuron n2 in mlp[layer + 1])
     {
         ((Neuron)n2).AddInputNeuron(n);
     }
 }