Week 3, assignment 2

Can someone please help me understand why the layers have number of nodes in input, hidden and output layers respectively as (5, 4, 2) rather than being (2, 4, 1) as there are 2 input features and one target variable.

Welcome to the community.

Please do not mix up global variables and local variables.
A global variable X is in the shape of (2,400) as you see. For a testing, new global variables t\_X and t\_Y are set by layer_sizes_test_case(). The shape of t\_X is (5,3). Then, this t\_X and t\_Y are passed to layer_sizes() as X and Y which are local variables in Layers_sizes(). Those are only used inside this function. Same to Y. So, layer sizes are different from values that are calculated with global variables.