Conditional Graph Factorization is a submodule of the SimianQuant code generator that generalizes the concept of calibration. Given a sequence of partitions of the domain, it factorizes the full computational graph into a sequence of subgraphs conditional on the respective partition and the inferred codomain of the previous subgraph. This article illustrates the principle and some applications.
Concretely, given a computational graph G(X) with its input partitioned into a sequence of n subsets xi,i∈1…n, conditional graph factorization generates a sequence of subgraphs gi such that:
G(X)=gn(xn|gn−1(xn−1|⋯g1(x1)))
The arguments corresponding to partition xk don’t need to be known while evaluating subgraph gk−1, and multiple instances of those arguments can be used with a computed value of gk−1. The subgraph gk treats the outputs of gk−1 as preset constants. This construction therefore elegantly models cases where some of the arguments to a function change more frequently than others, or where the influence of varying one or more variables while keeping others constant needs to be studied.
As an illustration, consider a toy example: linear interpolation with flat extrapolation over two data points. The system has five inputs: the four data points x1, y1, x2, y2 and the test point x, and one output y. A stylized representation of the full computational graph is:
In practice, the data points are fixed (usually to match an observed system) and the test point is varied. Therefore the natural choice for partitioning the domain is into the data points (x1, y1, x2, y2) and the test point, x. Conditional graph factorization will split the full graph into two subgraphs:
- g1(x1,x2,y1,y2) with outputs x1, x2, y1, y2 and e4
- g2(x|x1,x2,y1,y2,e4) with output y
A stylized representation of the split computational graph is:
It is important to emphasize that this is not the only choice for the partition. For example, it is equally valid (though probably not as useful), to partition the domain as (x1, x2, y1 ) and (y2, x).
As expected, conditional graph factorization can and does significantly improve performance. As an example, consider 20 point cubic spline interpolation with and without conditional graph factorization:
In the non-factorized case, the function solves the equations for the spline coefficients each time it is evaluated. It should be noted that the non-factorized version is still 7x faster than Strata’s calibrated implementation, as presented here
Harshad
If a matrix is used in physics, it is invertible