Hangup understanding instructions for covariance_matrix_from_examples in this week's lab

Hi everyone! I’m having some trouble understanding how to handle covariance_matrix_from_examples when all we need to do is two function calls. I currently reshape the input vector into an (n_feature, n_feature) array and try passing it to np.covar with rowvar=True set only to end up with this:

The problem is in reshape. You have 60 * 128 examples in the array, but your reshape has only 4*4.

Reshape can take -1 for one dimension. In this case, the value is inferred from the length of the array and remaining dimensions.

So the second dimension should be n_feautres and the first one (which is a number of examples) should be inferred automatically using -1.

1 Like

Next step here. What’s the thought of trying to subtract a 4x4 matrix from a 7680x7680 matrix? Rightfully that wouldn’t work:

It seems to me like we got the reshape working correctly, but hitting a different error. What’s our thoughts here?

Hello @Bradley_M_Messer,

It is important to understand and implement what @aray has mentioned above. I’m linking this StackOverflow answer just in case you need more explanation along with examples. Once you are clear with that, go ahead and check the rowvar argument in the np.cov function. They have also mentioned in the hints “lookout for that argument”. So in case you are not using hints, check the documentation using the following link:

It was referred to in the hints above this GRADED question. I’m not sure if you missed the tips or purposefully ignored them because you wanted to handle this on your own. If the latter is the case, I respect that you are not immediately using the above hints and are instead seeking an explanation. However, because GANs, PyTorch, and NumPy are not easy concepts/frameworks, it is possible that you will get stuck like this frequently, and the solution is often some function/method or some argument to that function/method that we are unfamiliar with. So, as long as you understand the idea, it’s perfectly fine to use the hints.

Anyways, I hope this helps you. If not please let us know and keep posting your queries.
We are happy to help.

@shreyasvedpathak I appreciate the help and ask that we refrain from personal attacks in our work moving forward. I’ve done a sufficient amount of digging on my own and despite my prior experience (Issues in the grader for get_score - #3 by Bradley_M_Messer) have actually had to streamline code severely to actually understand what it was people were trying to say.

Right now, my job as a responsible technologist is to learn from you and my perspective is that despite being a routine thing, the documentation is lacking in some respect (I have reviewed everything multiple times). As we work through things together and understand what happened, then we can take appropriate action.

In my own work too, I’ve had to work with others who need more time than average and I roll with the punches (and have been on both the giving and receiving end of that exchange), regardless of whether I’m helping them at midnight when I’m ready to fall asleep or while I’m taking my meals (a 5 min question turning into something much more drawn out, but ultimately worth it).

Anyways, that’s my personal commitment to being a responsible technologist and is why I’m here. Your help in my ability to live up to that commitment (really something we all have and should strive for) is greatly appreciated.

1 Like

@Bradley_M_Messer I think there is a misunderstanding. I cannot tell you answers right away because of Code of Conduct, so I was trying to tell you incase you missed the hints, please refer to them. But if you don’t want to use the hints, I’m extremely happy with that. I just wanted to direct you towards that hint and not give answer directly.

I’m sorry if in anyway I have offended you. I never meant it that way.

I hope that there’s no confusion now.
English is not my first language maybe that’s why the sentence structure might have been a little bit off. I apologise again.

It takes a lot more (and I truly mean innuendos with friends of the truly disparaging type) to truly offend me. That being said, one of the hallmarks we have to play by as the human race is knowing when to bend or break the rules for greater societal progress and this is one of those instances due to the distributed nature of our work. If we were coworkers working through this issue, we’d have it covered by now.

I’d also propose that society as a whole needs to reframe how we think about intelligence, especially in very dynamic environments where our skills get rehashed completely every 2 years as it is, but unfortunately, at least from my perspective, archaic principles are codified into our code of conduct and other guiding principles, but unfortunately miss the greater picture of human progress forward.

In this instance, I have understood the material presented to me to the best of my ability, read through everything I can get my hands on:

and even curated every piece of material in my personal google drive so I have excellent references moving forward. At this point, I just need that help over the hump.

My proposition is that it is an educator’s job to get their students up to speed as quickly as possible so they can contribute in unique scenarios for companies and move on. Yes, we still have to generate original work and properly understand the material, but in high tech or research like we are, pulling our collective ahead as quickly as reasonably possible is probably the most important thing, even moreso than this point in time conversation we’re having right now.

By the way, I am also aware of the position that this is putting you and the people around in as well and I’m fully prepared to step forward to speak with them as well if you need me to. I’m not a fan of archaic getting in the way of human progress. Humans aren’t the ones that are broken. It’s the systems that we produce forcing these types of interactions that is what is truly broken.

and the reading also includes the numpy.cov — NumPy v1.21 Manual
and numpy.reshape — NumPy v1.21 Manual
shown in the hints.

@shreyasvedpathak I just wanted to touch base again and mention that I would appreciate your help in working through this issue. I’ve definitely given this enough effort at this point and know the ordering of my code is correct minus minor failings. I’d prefer at this point to just meet up somehow and get this taken care of