Incorrect "expected value" for compute cost

Please guide me

Hello @Muhammed_sahal

One of the things to check would be the indentation of z_wb += b…whether this is inside the inner for loop or outside it.

Hello @shanup ,its inside the loop

@Muhammed_sahal

if its inside the loop, it will get added n times instead of once. So, the question is do you want b to be added n times?

B remains constant throughout ,hope not.

I did try by removing b though removing it doesn’t make sense and i don’t want b to change its value.The value of expected output remains same regardless of the changes and I don’t understand why

What i meant was,

we need to calculate this:

w_1.x_1 + w_2.x_2+...+w_n.x_n +b

Not

w_1.x_1 + w_2.x_2+...+w_n.x_n +b+b+...+b

Yes i understood that part but can I take it outside the loop in the middle of the loop.Wouldnt that lead to indentation error​:thinking:

But that line does not need to be in the middle of the inner loop. It can be the first line OUTSIDE of the inner loop. Why do you think it would lead to indentation error?

The hint says otherwise.Would it be okay to add b before i loop?

In the hint it says b can be inside the loop.But I’m confused since b doesn’t need to be looped.

Hey @Muhammed_sahal,

Where exactly in the hints this is mentioned? :thinking:

Cheers,
Elemento

@Muhammed_sahal

If you look closely at the hint provided, you will notice that the indentation is different for this line when compared to the previous line.

Hey @shanup I corrected the indentation but the expected value is not the same.

I’m a novice,pardon my mistakes

I will send you a DM.

1 Like

Hey @Muhammed_sahal,
There’s absolutely nothing to feel sorry about. Everyone starts somewhere, and everyone needs help when they start. When I started out as a learner in my first course of DeepLearning.AI, I also used to ask a lot of doubts. So just keep moving forward! We are all here to help you out only. And if we can help you with anything else, let us know :blush:

Cheers,
Elemento

2 Likes