cost function and loss function in machine learning