# C2_W1_Assignment why not minimise total cost instead of loss function

I have a simple question: If the total cost is f(w) = Paw + Pb(1-w) then why not simply try to minimise this cost? Instead, we are trying to minimise the loss function, which actually gives us wrong answer to the question in hand.

The loss function is mimum at w = 0.702. This gives the avg cost of 100.562. But instead if we take w = 0 ( that means only by from B), we get avg cost of 100.

Am I missing something here?

1 Like

Minimizing the loss function is how we find the best value for the weights. This lets us create a model that best fits the data set.

1 Like

I mean yeah I see where we can use the loss function. Though, according to the problem statement “best value” here should have been least total cost, which is when we take “w” as 0 not when “w” is 0.702.

I think its fine if aim of the assement was to minimize loss function but I guess then the description of the problem statement should say that instead of saying that we are going to mimimise the total cost.

There are two different meanings of “cost” in this assignment.

Only one of them is what we’re optimizing for - that’s the squared sum of the errors in the model.

I agree it’s confusing, because the example they’re using also has a ‘cost’ variable, but that relates to the prices of the items, and not the quality of the model.