Hi there,
I tried the assignment of week 1.
Although I finished the assignment and run the result successfully, I had some questions about what W[:,j] is.
1> I tried to print( W[: , j] ), but nothing happened.
2> units = W.shape[1] is 3. if W is a matrix with 3 columns, when did we assign a matrix to W?
Thanks
The following is the codes.
{code removed by mentor}
Hello Nick @Nick_Han,
This is how I traced back to the source of W
.
And here is how I would test what W[:,j]
is. Create a temporary, new cell, and type the following:
W= 0.1*np.arange(1,7,1).reshape(2,3) # copy this line from the assignment
j = 2 # assign some value to j
print(W[:,j]) # check out its content
print(W) # compare the above content with the content in `W`
# Then I would change the value of `j` to some reasonable and unreasonable values and see if things go as I expect.
# Try W[j] and W[j,:] if you have time
After all the tests, please remember to remove the temporary cell since any cells created by learners might interfere negatively with the autograder and we won’t want to take that chance.
Happy new year, and cheers,
Raymond
PS: I am removing your assignment code for you since we can’t share it here in accordance with the community guideline. Perhaps you can make up some simple toy code, like what I made here, to elaborate your question next time 
1 Like
Thank you Raymond.
I got it. In the function, it is like we set up a veihcle which can contain an array. When we do the quick check, we assign a w_tmp array and then W[: ,J] would have value.
We may be able to assign 2*3, 4*8 or other dimensions of matrix to the parameter W as well if I do not get it wrong.
No problem. Please do that. I forgot to hide the answers of the assignment. will do that next time.
Thanks
Hello @Nick_Han,
You are absolutely right that we can have any size of arrays as long as we know why and where we need it. Good luck going down the rest of the course 2, and let us know if you have other questions 
Cheers,
Raymond