Re:A friendly Introduction to Backpropagation in Python
by sushantc on Sunday November 26, 2017 @09:32PM
(#15784410)
Thanks partycoder! Points taken; will make some changes.
Regarding numerical gradients, named it so to differentiate it from analytical gradients, which leverage formulas from calculus. The "numerical" ones are calculated using (f(x+h)-f(x))/h every time.
Re:A friendly Introduction to Backpropagation in Python
by ydidntithnkftht on Sunday November 26, 2017 @10:39PM
(#15784630)
Python community conventions are not camel case for functions...
forwardAddGate
would be
forward_add_gate
and return is not a function call...
return(max(x,y)) or return(x+y)
would be
return max(x, y) or return x + y
spaces around operators...
x + y not x+y
spaces around function args...
def foo(a, b) not def foo(a,b)
and when calling...
foo(1, 2) not foo(1,2)
https://www.python.org/dev/peps/pep-0008/
Just things to think about when publishing python code for the greater community.
Re:A friendly Introduction to Backpropagation in Python
by partycoder on Monday November 27, 2017 @01:59AM
(#15785388)
There's a package that verifies PEP8 for you.
https://pypi.python.org/pypi/pep8
Re:A friendly Introduction to Backpropagation in Python
by partycoder on Sunday November 26, 2017 @11:01PM
(#15784718)
I see the difference now, thanks for the clarification.
1) I would make a better distinction between the function declaration and the program output. e.g: format the output differently. like gray.
2) Capitalization. "InvalidWRTargError". It would help if you could capitalize it as "InvalidWrtArgError". This is a guideline in most coding standards. https://en.wikipedia.org/wiki/Camel_case#In_abbreviations
3) Better naming:
- "getNumericalForwardGradient": Are there non-numerical gradients?
- "applyGradientOnce": A function is applied once per invocation by convention.
Then it would be good if you formatted using PEP8, as it is standard in Python.