A cost function is also known as a loss or error function and is a measure for evaluation of the performance of your model. It is used for computation of the error during backpropagation. The error is pushed backward via the neural networks and is further used during different training functions.