What are the loss function and cost function? Explain the difference between them.
Loss function | Cost function |
---|---|
Used when referring to errors in a single training example. | Used to refer to the average of the loss function over the training set. |
The purpose of the loss function is to capture the difference between actual and predicted values in a single dataset | The cost function aggregates the differences across the training data set. The frequently used loss functions are called squared error and hinge loss. |
This is a way of evaluating how well the algorithm models the data set. | A cost function refers to the functional relationship between cost and performance. Assuming constant technology, we examine the behavior of costs at different levels of production. |
BY Best Interview Question ON 30 Dec 2023