소스 검색

Add parameter for hidden neurons number

DricomDragon 5 년 전
부모
커밋
2a9623e148
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      python/lab/neural.py

+ 7 - 2
python/lab/neural.py

@@ -7,9 +7,14 @@ class Network():
 	Structure holding neural network attributes
 	"""
 
-	def __init__(self, activationFunction, activationDerivative):
+	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 = 30
+		self.hiddenLength = hiddenLength
 		self.outputLength = 10
 		self.activationFunction = activationFunction
 		self.activationDerivative = activationDerivative