Confusion in Week 1

Hi there,

The uploaded image is from the lecture “When to Change Dev/Test Sets and Metrics?” of Week 1. Even though Sir Andrew told us not to worry too much about how the cost function J has been defined, I am very confused whether it has been correctly defined here. Will this equation not result in the effect of w(i) being completely cancelled out? Or am I missing something here?

1 Like

Hi Zeeshan,

At first glance it might seem like that but let’s take a quick example.
Let W(i) be [1, 2, 3] and the L(y^(i), y(i)) be [4, 5, 6], so ‘i’ basically goes from 1 to 3. The formula now becomes:

J = ( i=1Σ3 W(i) L(y^(i), y(i)) ) / i=1Σ3 W(i)

=> J = (1 * 4 + 2 * 5 + 3 * 6) / (1 + 2 + 3)
=> J = (4 + 10 + 18) / 6
=> J = 32 / 6
=> J = 16/3

If you had directly cancelled out the W(i)s then you would have had the answer as => 4+5+6 => 15

Hope this helps.

1 Like

This clarifies the confusion. Thank you!

Hi @SomeshChatterjee,

Thanks for your explanations but one thing is still confusing to me.

Assuming we have only one coefficient, say 10, for false-positive porn images, and we have a set of 3 false-positive examples, the error of each example would be 1 and we’ll have:
J non-porn = (1 + 1 + 1) / 3 = 1
J porn = (10 * 1 + 10 * 1 + 10 * 1) / (10 + 10 + 10) = 1 but in this case we’d want to have 10 instead of 1.

Is there a mistake in my reasoning?