Implementing Custom Loss Functions
There are several types of loss functions that are commonly used for machine learning. In Chapter 5, Classification, you studied different types of loss functions and used them with different classification models. TensorFlow has quite a few built-in loss functions to choose from. The following are just a few of the more common loss functions:
- Mean Absolute Error (MAE)
- Mean Squared Error (MSE)
- Binary cross-entropy
- Categorical cross-entropy
- Hinge
- Huber
- Mean Squared Logarithmic Error (MSLE)
As a quick reminder, you can think of loss functions as a kind of compass that allows you to clearly see what is working in an algorithm and what isn't. The higher the loss, the less accurate the model, and so on.
Although TensorFlow has several loss functions available, at some point, you will most likely need to create your own loss function for your specific needs. For instance, if you are building a model that...