Пример #1
0
 public PredictorMLP(int aDimension, int aInputLength)
 {
     dimension = aDimension;
     inputLength = aInputLength;            
     mlp = new MLP(new int[] { 30, dimension }, dimension * inputLength);
     r = new Random();
     mu = 0.0001;
     trainCount = 0;            
 }
Пример #2
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++;
            }
        }
Пример #3
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++;
            }
        }