i read that the cost function be a negative number,

is that for linear regression also ?

and how the MSE can be a negative number?

You can choose some cost function, which can have negative values too. Like Mean error,

that in which mean of all error : (y - y’) is calculated. where y = actual value, y’ is predicted value. But this cost function is generally not used, as positive and negative error cancels each other and even if you have high value for error in both towards positive and negative values, your cost function still can have close to zero value.

Mean squared error cannot be negative,it is square of (y - y’), as square of real numbers can never be negative.

Typically, cost is never a negative value. This is true for both the linear and logistic cost functions.

Can you give an example where you read that?

If the cost function is squared error, then that is always positive. What can be negative is the partial derivative of the cost function (dJ/dw), which is the evaluation of the gradient.

Hello @Hokie81,

Even though the squared error is always positive, its derivative isn’t.

Cheers,

Raymond

I know, that’s what I said in my answer.