neural.py 575 B

12345678910111213141516171819202122
  1. # Store a neuronal network
  2. import numpy as np
  3. class Network():
  4. """
  5. Structure holding neural network attributes
  6. """
  7. def __init__(self, activationFunction, activationDerivative):
  8. self.inputLength = 784
  9. self.hiddenLength = 30
  10. self.outputLength = 10
  11. self.activationFunction = activationFunction
  12. self.activationDerivative = activationDerivative
  13. self.layer1 = np.zeros((self.hiddenLength, self.inputLength))
  14. self.bias1 = np.zeros(self.hiddenLength)
  15. self.layer2 = np.zeros((self.outputLength, self.hiddenLength))
  16. self.bias2 = np.zeros(self.outputLength)