To illustrate one of the less intuitive effects of Python-Numpy,

especially how you construct vectors in Python-Numpy, let me do a quick demo.

Let's set a = np.random.randn(5),

so this creates five random Gaussian

variables stored in array a.

And so let's print(a) and now it turns out that

the shape of a when you do this is this five color structure.

And so this is called a rank 1 array in Python and

it's neither a row vector nor a column vector.

And this leads it to have some slightly non-intuitive effects.

So for example, if I print a transpose, it ends up looking the same as a.

So a and a transpose end up looking the same.

And if I print the inner product between a and a transpose, you might think

a times a transpose is maybe the outer product should give you matrix maybe.

But if I do that, you instead get back a number.

So what I would recommend is that when you're coding new networks,

that you just not use data structures where the shape is 5, or n, rank 1 array.

Instead, if you set a to be this, (5,1),

then this commits a to be (5,1) column vector.

And whereas previously, a and a transpose looked the same,

it becomes now a transpose, now a transpose is a row vector.

Notice one subtle difference.

In this data structure, there are two square brackets when we print a transpose.

Whereas previously, there was one square bracket.

So that's the difference between this is really a 1 by

5 matrix versus one of these rank 1 arrays.

And if you print, say, the product between a and a transpose,

then this gives you the outer product of a vector, right?

And so, the outer product of a vector gives you a matrix.

So, let's look in greater detail at what we just saw here.

The first command that we ran, just now, was this.

And this created a data structure with

a.shape was this funny thing (5,) so

this is called a rank 1 array.

And this is a very funny data structure.

It doesn't behave consistently as either a row vector nor a column vector,

which makes some of its effects nonintuitive.

So what I'm going to recommend is that when you're doing your programing

exercises, or in fact when you're implementing logistic regression or

neural networks that you just do not use these rank 1 arrays.