def predict(self, X): """Return the probability of x belonging to either class""" hidden = sigmoid(self.Wh @ X + self.bh) scores = self.Ws @ hidden + self.bs probs = softmax_vectorized(scores) return probs.argmax(axis=0)
def forward(self, z): self.h = sigmoid(z) return self.h
def forward(self, Z): self.h = sigmoid(Z) return self.h