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

Dev #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Dev #1

wants to merge 3 commits into from

Conversation

vasylcf
Copy link
Owner

@vasylcf vasylcf commented Mar 25, 2019

Realization:

  • Python_basic_with_numpy
  • Logistic_regression_as_a_neural_network

@@ -853,19 +971,25 @@
" \"\"\"\n",
" \n",
" ### START CODE HERE ### (≈ 1 line of code)\n",
" loss = None\n",
" loss = np.sum(abs(y-yhat))\n",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Возможно тут лучше явно обращаться к функциям numpy
loss = np.sum(np.abs(y-yhat))
потому что "Explicit is better than implicit" https://www.python.org/dev/peps/pep-0020/#id3

Хотя этот код тоже будет правильно работать
https://stackoverflow.com/questions/20953127/why-built-in-functions-like-abs-works-on-numpy-array

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Внес правки и добавил np.abs
Никогда не задумывался, какая разница между np.abs и abs ...

"\n",
" # Gradient descent (≈ 1 line of code)\n",
" parameters, grads, costs = None\n",
" parameters, grads, costs = optimize(w, b, X_train, Y_train, num_iterations, learning_rate, print_cost = False)\n",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не стоит тут хардкодить print_cost = False. Лучше в optimize() пробросить значение print_cost, которое принимает model(), иначе теряется смысл передавать гиперпараметр print_cost в метод model()

Screenshot at 16-11-02

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Согласен с замечанием, добавил необходимые правки в "model"

@party13
Copy link

party13 commented Mar 30, 2019

great!

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

Successfully merging this pull request may close these issues.

3 participants