rajd216
rajd216

Reputation: 29

Cost Function & Mean Squared error formulae

I am new to machine learning and statistics and am confused with the cost function & Mean Squared Error (MSE) formulas. In Machine learning class at stanford - coursera, Cost function formula is mentioned as shown below:

Cost Function formula

enter image description here

And at some other sources, cost function is termed as mean squared error (MSE) and it is given with the formula as shown in picture below.

Mean Squared Error formula

enter image description here

What will be the Cost Function formula & is cost function and MSE different or same. Please let me know why are the formulas are different.

Thanks in Advance

Raj

Upvotes: 2

Views: 3902

Answers (1)

reza karimi
reza karimi

Reputation: 174

The cost function is just telling you how bad you're doing. If it's high, that means your prediction is far away from the actual value. if it's zero, it means that you are predicting every single output correctly. In coursera version the sigma term is divided by 2m and in the other version it is divided by m (m is the number of training examples). It doesn't matter in what the cost function is doing, since m is just a constant. Dividing by 2m is just a mathematical convenience. For example, if the sigma term is 100 and m is 10, cost function in coursera version is going to be 5 and in the other version it's going to be 10. Since you're trying to make cost function 0, it doesn't matter what value it returns. You just need a tool to measure how bad you're doing.

Upvotes: 4

Related Questions