Many machine learning problems involves loss function that contains random variables. To perform backpropagation, estimating gradient of the loss function is required.
This paper tried to formalize the computation of gradient of loss function with computation graphs. Assume we want to compute . There are two differnt way that random variable x can be influenced by .
- Score Function Estimator
If probability distribution is parametrized by , the gradient can be estimated with score function estimator.
Score function extimator is also known as likelihood ratio estimator, or REINFORCE.
- Pathwise derivative
If x is deterministically influenced by another random variable z which is influenced by the gradient can be estimated with pathwise derivative.
If appear both in the probability distribution and inside expectation,
To formallize this with directed acyclic graph, this paper represent deterministic nodes with squares and stochastic nodes with circles. Some example can be shown as below. Further notation can be defined as below. Given differentiability requirements hold, the gradient of sum of costs can be represented as two equivalent equations. This paper suggest surrogate loss function which convert the stochastic graphs to deterministic graphs from equation above.
To reduce the variance of score function estimator we can subtract the baseline estimate of the function. Algorithm is as below.
Great summary and clean formalation of getting gradient of function with stochatic variables.
Subscribe via RSS