Ejemplo n.º 1
0
 public Layer(int nodeCount, IWeightInitilizer weightInitilizer, IActivationFunction activationFunction)
 {
     Initialize(nodeCount, (index) =>
     {
         _nodes[index] = new Node(weightInitilizer.GetWeights(), activationFunction);
     });
 }
Ejemplo n.º 2
0
 public Layer(int nodeCount, IWeightInitilizer weightInitilizer)
 {
     Initialize(nodeCount, (index) =>
     {
         _nodes[index] = new Node(weightInitilizer.GetWeights());
     });
 }
Ejemplo n.º 3
0
        public NeuralNetwork(double learnRate, IActivationFunction activationFunction,
                             IWeightInitilizer weightInitilizer, ILossFunction lossFunction)
        {
            if (activationFunction == null)
            {
                throw new Exception("[NeuralNetwork] activationFunction is null.");
            }
            if (weightInitilizer == null)
            {
                throw new Exception("[NeuralNetwork] weightInitilizer is null.");
            }
            if (lossFunction == null)
            {
                throw new Exception("[NeuralNetwork] lossFunction is null.");
            }

            _learnRate          = learnRate;
            _activationFunction = activationFunction;
            _weightInitilizer   = weightInitilizer;
            _lossFunction       = lossFunction;

            Layers = new List <Layer>();
        }