# Comparing and studying Loss Functions

I have a Deep Feedforward Neural Network $$F: W \times \mathbb{R}^d \rightarrow \mathbb{R}^k$$ (where $$W$$ is the space of the weights) with $$L$$ hidden layers, $$m$$ neurones per layer and ReLu activation. The output layer has a softmax activation function.

I can consider two different loss functions:

$$L_1 = \frac{1}{2} \sum_i || F(W,x_i) - y||^2$$ $$\ \ \$$ and $$\ \ \ L_2 = -\sum_i log(F(w,x_i)_{y_i})$$

where the first one is the classic quadratic loss and the second one is cross entropy loss.

I'd like to study the norm of the derivative of the loss function and see how the two are related, which means:

1) Let's assume I know that $$|| \frac{\partial L_2(W, x_i)}{\partial W}|| > r$$, where $$r$$ is a small constant. What can I assume about $$|| \frac{\partial L_1(W, x_i)}{\partial W}||$$ ?

2) Are there any result which tell you that, under some hypothesis (even strict ones) such as a specific random initialisation, $$|| \frac{\partial L_1(W, x_i)}{\partial W}||$$ doesn't go to zero during training?

Thank you

## 1 Answer

Let's first express a network of arbitrary topology and heterogeneous or homogeneous cell type arrangements as

$$N(T, H, s) := \, \big[\, \mathcal{Y} = F(P_s, \, \mathcal{X}) \,\big] \\ s \in \mathbb{C} \; \land \; s \le S \; \text{,}$$

where $$S$$ is the number of learning states or rounds, $$N$$ is the network of $$T$$ topology and $$H$$ hyper-parameter structure and values that at stage $$s$$ produces a $$P$$ parameterized function $$f$$ of $$\mathcal{X}$$ resulting in $$\mathcal{Y}$$. In supervised learning, the goal is that $$F(P_s)$$ approaches a conceptually ideal function $$F_i$$ as $$s \rightarrow S$$.

The popular loss aggregation norms are not quite as the question defines them. The below more canonically expresses the level 1 and 2 norms, which systematically aggregate multidimensional disparity between an intermediate result at some stage (epoch and example index) of training and the conceptual ideal toward which the network in training is intended to converge.

$${||F-\mathcal{Y}||}_1 = \sum{|F_i - y_i|} \\ {||F-\mathcal{Y}||}_2 = \sqrt{\sum{(F_i - y_i)}^2}$$

These equations have been mutated by various authors to make various points, but those mutations have obscured the obviousness of their original relationship. The first is where distance can be aggregated through only orthogonal vector displacements. The second is where aggregation uses the minimum Cartesian distance by extending the Pythagorean theorem.

Note that quadratic loss is a term with some ambiguity. These are all broadly describable as quadratic expressions of loss.

• Distance as described in the second expression above
• RMS where the sum is divided by the number of dimensions $$\text{count}(i)$$
• Just the sum of squared difference by itself

Cross entropy is an extension of Claude Shannon's information theory concepts based on the work of Bohr, Boltzmann, Gibbs, Maxwell, von Neumann, Frisch, Fermi, and others who were interested in quanta and the thermodynamic concept of entropy as a universal principle running through mater, energy, and knowledge.

$$S = k_B \log{\Omega} \\ H(X) = - \sum_i p(x_i) \, \log_2{\, p(x_i)} \\ H(p, \, q) = -\sum_{x \in \mathcal{X}} \, p(x) \, \log_2{\, q(x)}$$

In this progression of theory, we begin with a fundamental postulate in quantum physics, where $$k_B$$ is Boltzmann's constant and $$\Omega$$ are the number of microstates for the quanta. The next relation is Shannon's adaptation for information, where $$H$$ is the entropy in bits, thus the $$\log_2$$ instead of a natural logarithm. The third relation above expresses cross-entropy in bits for features $$\mathcal{X}$$ is based on the Kullback-Leibler divergence. the p-attenuated sum of bits of q-information in .

Notice that $$p$$ and $$q$$ are probabilities, not $$F$$ or $$\mathcal{Y}$$ values, so one cannot substitute labels and outputs of a network into them and retain the meaning of cross entropy. Therefore level 1 and 2 norms are closely related, but cross-entropy is not a norm; it is the dispersion of one thing Cartesian distance aggregation scheme like them. Cross-entropy is remotely related but is statistically more sophisticated. To produce a cross-entropy loss function of form

$${||F-\mathcal{Y}||}_H = \mathcal{P}(F, y) \; \text{,}$$

one must derive the probabilistic function $$\mathcal{P}$$ that represents the cross entropy for two distributions in some way that is theoretically sound on the basis of both information theory and convergence resource conservation. It is not clear that the interpretation of cross entropy in the context of gradient descent and back propagation has caught up with the concepts of entropy in quantum theory. That's an area needing further research and deeper theoretical consideration.

In the question, the cross-entropy expression is not properly characterized, most evident in the fact that the expression is independent of the labels $$\mathcal{Y}$$, which would be fine if for unsupervised learning except that no other basis for evaluation is represented in the expression. For the term cross-entropy to be valid, the basis for evaluation must include two distributions, a target one and one that represents the current state of learning.

The derivatives of the three norms (assuming the cross entropy is properly characterized) can be studied for the case of $$\ell$$ ReLU layers by generalizing the chain rule (from differential calculus) as applied to ReLU and the loss function developed by applying each of the three norms to aggregate measures of disparity from optimal.

Regarding the inference in sub-question (1) nothing of particular value can be assumed about the Jacobians of level 2 norms from level 1 norms, both with respect to parameters $$P$$ or vice versa, except the retention of sign. This is because we cannot determine much about the correlation between the output channels of the network.

There is no doubt, regarding sub-question (2), that some constraint, set of constraints, stochastic distribution applied to initialization, hyper-parameter settings, or data set features, labels, or number of examples have implications for the reliability and accuracy of convergence. The PAC (probably approximately correct) learning framework is one system of theory that approaches this question with mathematical rigor. One of its practical uses, among others, is to derive inequalities that predict feasibility in some cases and produce more lucid approaches to learning system projects.