Two variables cannot be oriented by conditional independence tests, but a restricted model can break the symmetry. In every data set below X causes Y. Fit Y = f(X) + noise and X = g(Y) + noise by polynomial regression, and ask in which direction the residual is independent of the input. The dependence is measured by HSIC; the smaller one points the arrow.
HSIC is the biased estimate tr(KHLH)/N² with Gaussian kernels whose widths are the median distances; the p-value comes from 100 random permutations (it changes a little from run to run of the page). Both variables are standardised first. The slope and entropy rules assume no noise, so they are only meaningful for the last data set.
code/ch30_graph_learning.py (anm_direction, hsic, igci_slope, igci_entropy).