Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12.3. GDM #29

Closed
tuanlda78202 opened this issue Oct 11, 2021 · 3 comments
Closed

12.3. GDM #29

tuanlda78202 opened this issue Oct 11, 2021 · 3 comments

Comments

@tuanlda78202
Copy link

tuanlda78202 commented Oct 11, 2021

Chapter 12 GDM, the part I code myself, is different from the result in the book; I checked the code of Mr Tiep also encountered the same situation. Then I detect; specifically, it is the one that initially creates the y value: we use the np.random.random(1000) function, we will return an array with shape (1000,) if we do not notice y.reshape(-1, 1) to match matrix addition and subtraction operations, it will be confusing (because py is different in size, it will treat it as broadcasting). Yes, grad will return a vector, but it returns a matrix because of the confusion above. That leads to consequences; later on, the code does not run correctly.
Source code fix : https://bit.ly/3mFp8N1 or https://bit.ly/3iOXImD

244433855_2846991418944200_9069998415242239147_n
244355556_2846990928944249_1399441177654916885_n

@tiepvupsu
Copy link
Owner

Cảm ơn bạn đã báo lỗi. Mình cũng chưa hiểu rõ phải sửa chỗ nào. Bạn có thể tạo PR giúp mình vào file này được không? Cảm ơn bạn.

@tuanlda78202
Copy link
Author

Em thật sự cũng chưa biết tạo PR kiểu gì cả ạ nhưng mà nó nằm ở dòng 399 ở cái file anh gửi, chỗ y phải sửa thành y.reshape(-1,1) ạ

image

@tiepvupsu
Copy link
Owner

Mình đã fix ở commit này c77574c nhé. Mình đổi lại cho giống trên web. Cảm ơn bạn đã đóng góp.

@tuanlda78202 tuanlda78202 changed the title 12.3. GD cho hàm nhiều biến 12.3. GDM Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants