28.04.2020 Views

Sách Deep Learning cơ bản

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.4 Bài tập 95

# Dự đoán

def predict(self, X):

for i in range(0, len(self.layers) - 1):

X = sigmoid(np.dot(X, self.W[i]) + (self.b[i].T))

return X

# Tính loss function

def calculate_loss(self, X, y):

y_predict = self.predict(X)

#return np.sum((y_predict-y)**2)/2

return -(np.sum(y*np.log(y_predict) + (1-y)*np.log(1-y_predict)))

6.4 Bài tập

1. Tính backpropagation với neural netwrok có 1 hidden layer đã implement từ bài trước.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!