123456789101112131415161718192021222324252627 |
- # Store a neuronal network
- import numpy as np
- class Network():
- """
- Structure holding neural network attributes
- """
- def __init__(self, activationFunction, activationDerivative, hiddenLength = 30):
- """
- activationFunction : the ceil function to apply on network outputs
- activationDerivative : the derivative function of the activationFunction
- hiddenLength : number of neurons in the hidden layer
- """
- self.inputLength = 784
- self.hiddenLength = hiddenLength
- self.outputLength = 10
- self.activationFunction = activationFunction
- self.activationDerivative = activationDerivative
- self.layer1 = np.zeros((self.hiddenLength, self.inputLength))
- self.bias1 = np.zeros(self.hiddenLength)
- self.layer2 = np.zeros((self.outputLength, self.hiddenLength))
- self.bias2 = np.zeros(self.outputLength)
|