为什么我收到此错误
sigmoid()需要1个位置参数但是2个被赋予
使用函数yHat = NN.forward(X)??
class Neural_Networks(object):
def __init__(self):
self.inputLayerSize =2
self.outputLayerSize =1
self.hiddenLayerSize = 3
#weights
self.W1 = np.random.randn(self.inputLayerSize, self.hiddenLayerSize)
self.W2 = np.random.randn(self.hiddenLayerSize, self.outputLayerSize)
def forward(self,X):
#propogates input through network
self.z2 = np.dot(X, self.W1)
self.a2 = self.sigmoid( self.z2 )
self.Z3 = np.dot(self.a2,self.W2)
yHat = self.sigmoid(self.z3)
return yHat
def sigmoid(z):
return 1/(1+np.exp(-z))