Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class my_NN(object):
- def train(self, X, y, iteration=33):
- for i in range(iteration):
- y_hat = self._forward_propagation(X)
- loss = self._loss(y_hat, y)
- self._backward_propagation(X,y)
- self._update()
- if i%10==0:
- print("loss: ", loss)
- def predict(self, X):
- y_hat = self._forward_propagation(X)
- y_hat = [1 if i[0]>0.5 else 0 for i in y_hat.T]
- return np.array(y_hat)
- def score(self, predict, y):
- cnt = np.sum(predict==y)
- return (cnt/len(y))*100
Add Comment
Please, Sign In to add comment