Link to the classroom item: link here
As plt_gradients is called in the cell 7 of the jupyter notebook, I took a look inside the lab_utils_uni.py file to see what the function was doing behind the scene.
On line 355, inside the function plt_gradients(), we are passing f_compute_cost and f_compute_gradient functions but I could not find where those functions are defined in the code - I have checked inside lab_utils_uni.py and lab_utils_coomon_py but they are not there.
Can somebody point me where I can find them so I can understand what the code is doing?
Note that “f_compute_cost()” is a pointer to some function. It doesn’t have to include the function arguments, because those are specified by that function’s definition.
The names of the variables don’t have to match up, because what matters is the order of the parameters in the function call - not their specific names.
Yes. This happens via the function definition, when the function is called. It’s automatically part of the python language.
All programming languages have this feature. Variables and objects (such as function pointers) are passed between different execution scopes via being passed as function parameters.