Computation Graph

Let’s use a simple function, to illustrate a computation graph.

Computing this function has 3 distinct steps.

  1. Compute
  2. Compute
  3. Compute

From top to bottom, the value of J can be computed. In order to calculate derivatives, you will calculate from bottom to top.

*generated with digraph

G:\GoogleDrive\deeplearning>diagrams dot computationgraph.dot images/computationgraph.svg

Derivatives with Computation graph

Derivative of with respect to .

If we were to nudge the value a litte bit, how would the value of J change? and , so if then , so goes 3 times up, so . To compute derivative of with respect to v, we went one step backwards to .

Derivative of with respect to .

If we were to nudge the value a litte bit, how would the value of change? and , so if then , and , so goes 3 times up, so . To compute derivative of with respect to a, we went two step backwards to v.

In calculus, is the product of how much changes to J and v, and it can be written as . this is called chain rule. IN this example, and so

Final output in this case is

where and

Notation:

Derivative of with respect to

(or )

Derivative of with respect to

With chain rule,

Derivative of with respect to

To compute derivative in the computational graph, calculate from the bottom to the top.