The fourth component necessary for building a deep learning model. The loss (also known as cost) function defines how well the model performs given a ground truth. This function will be minimized during training, and should be chosen carefully for the given model and data types.

The Loss class defines how the model's outputs are compared to a ground truth. In general, you pass in inputs and targets as parameters to the object, where inputs is the expression of the Model that describes the end computation and targets is the Theano variable representing ground truth.

Please refer to the opendeep.optimization.loss package for all built-in Loss functions. Alternatively, you can wrap your own custom function in a Loss object.