Interview Questions: What’s the role of a cost function?

src: Primo.ai

Cost function is used to learn the parameters in the machine learning model such that the total error is as minimal as possible. It is a measure of how wrong the model is in terms of its ability to estimate the relationship between the dependent and independent variable.

It is a mathematical function that measures the difference between the predicted output of a…