public PerceptronInitParams(
     LayerStructure layerStructure,
     Func <float, float> activationFunction,
     TrainParams trainParameters,
     float bias = 1)
 {
     LayerStructure     = layerStructure;
     ActivationFunction = activationFunction;
     TrainParameters    = trainParameters;
     Bias = bias;
 }
Ejemplo n.º 2
0
        private void CreateEmptyWeights(LayerStructure layerStructure)
        {
            Weights = new List <float[, ]>();

            float[,] firstLayerWeight = new float[layerStructure.InputLayerNodesCount,
                                                  layerStructure.HiddenLayers.ElementAt(0)];
            Weights.Add(firstLayerWeight);

            for (int i = 1; i < layerStructure.HiddenLayers.Count(); i++)
            {
                float[,] hiddenLayerWeights =
                    new float[layerStructure.HiddenLayers.ElementAt(i - 1), layerStructure.HiddenLayers.ElementAt(i)];
                Weights.Add(hiddenLayerWeights);
            }

            float[,] lastLayerWeight =
                new float[layerStructure.HiddenLayers.Last(), layerStructure.OutputLayerNodesCount];
            Weights.Add(lastLayerWeight);
        }