Exemple #1
0
        public Perceptron(Data.NetworkParam param)
        {
            if (param == null)
                throw new ArgumentNullException();

            layerList = new List<Layer>(param.LayerNumber);
            if(param.Neurons == null || param.Neurons.Count == 0)
                throw new ArgumentNullException();
            int layers = param.Neurons.Count;
            this.inputSize = param.Neurons[0];
            this.outputSize = param.Neurons[layers - 1];
            this.type = param.Type;
            this.solutionLayerNr = param.SolutionLayerNr;

            for (int i = 0; i < layers; i++)
            {
                Layer l = new Layer(i+1, param.Neurons[i]);
                l.SetFunction(param.Functions[i]);
                layerList.Add(l);
            }

            SetRandomWeights();
        }