Importance of Loss Function in Machine Learning

#artificialintelligence 

Assume you are given a task to fill a bag with 10 Kg of sand. You fill it up till the measuring machine gives you a perfect reading of 10 Kg or you take out the sand if the reading exceeds 10kg. Just like that weighing machine, if your predictions are off, your loss function will output a higher number. As you experiment with your algorithm to try and improve your model, your loss function will tell you if you're getting(or reaching) anywhere. "The function we want to minimize or maximize is called the objective function or criterion. When we are minimizing it, we may also call it the cost function, loss function, or error function" - Source At its core, a loss function is a measure of how good your prediction model does in terms of being able to predict the expected outcome(or value).