Kernel independence tests ask whether two groups of variables are statistically related. They work by comparing samples through a similarity function, usually a Gaussian kernel whose "width" sets how far apart two points can be and still count as similar. Nearly every pipeline standardizes each feature to unit variance and then uses one width for all features, either the median pairwise distance (the "median trick") or a value chosen by cross-validation. This setup treats every feature as equally important. A feature made of pure noise gets the same weight in the distance as the one feature that carries the dependence, and with enough nuisance features the signal is drowned out.
We propose to learn one width per feature, which amounts to learning the feature scaling itself. The widths are chosen by gradient descent on the held-out squared-loss score of least-squares mutual information (LSMI), a dependence estimator whose fitted parameters have a closed form. Because the fit is closed-form, the validation score is a smooth function of the per-feature widths and can be differentiated exactly. The widths are then frozen and passed to an ordinary kernel test run on a separate split of the data. The claim is that this recovers most of the power lost to nuisance and heterogeneously scaled features while keeping the false-positive rate at its nominal level. It also costs polynomial rather than exponential time in the number of features.
Core Claim and Relation to Prior Work
The direct motivation is On Kernel Parameter Selection in Hilbert-Schmidt Independence Criterion. That paper shows the empirical HSIC statistic (the Hilbert-Schmidt Independence Criterion, a standard kernel dependence measure) is a crude approximation of LSMI. On that basis it tunes HSIC's width by LSMI cross-validation ($\text{HSIC}_{\text{CV}}$), which beats the median trick in power on rotated Gaussian mixtures. However, it searches over a single scalar width on unit-variance data. Least-squares independence regression for non-linear causal inference under non-Gaussian noise applies the same analytic cross-validation to tune both the regression and independence widths in causal discovery. It too uses scalar grids.
The theoretical case that a single width is the wrong object comes from Anisotropic function estimation using multi-bandwidth Gaussian processes. It proves that isotropic Gaussian processes miss the minimax contraction rate when smoothness differs across coordinates, and that per-coordinate inverse widths $a_j$ recover it. That result concerns Bayesian regression fit by Markov chain Monte Carlo sampling, not testing, so it motivates our design without supplying the method.
Two works supply the idea of learned per-feature scales but in the wrong regime. Adaptive Scaling for Feature Selection in SVMs learns a diagonal metric jointly with a support-vector classifier. That approach needs class labels and a margin objective, and it ran 40 to 100 times slower than a plain fit. Variational Metric Scaling for Metric-Based Meta-Learning learns dimension-wise scales of a neural embedding for few-shot classification. Neither has an unsupervised dependence objective.
HSIC Lasso (High-Dimensional Feature Selection by Feature-Wise Non-Linear Lasso) and its variational version (Effective Nonlinear Feature Selection Method based on HSIC Lasso and with Variational Inference) learn feature weights, but their per-feature widths are fixed by per-feature median heuristics. The variational paper names automatic width selection as future work. What we add over all of these is an objective, label-free, closed-form validation criterion that is differentiated with respect to a full vector of per-feature widths.
Concretely, the LSMI model writes the density ratio $w(x,y)=p(x,y)/(p(x)p(y))$ as $\hat w=\sum_{l}\alpha_l\,\phi_l(x,y)$. Each basis function is a Gaussian product centred at a sample, $\phi_l(x,y)=\exp\!\big(-\sum_{j=1}^{d}a_j(x_j-x_{l j})^2\big)\exp\!\big(-b\|y-y_l\|^2\big)$. Here $a_j>0$ is the inverse squared width for input feature $j$, and $b$ is the width parameter for the output variable $y$. The coefficients have a closed form, $\hat\alpha(\mathbf a)=(\hat H+\lambda I)^{-1}\hat h$. In that expression, $\hat H$ is the average of $\phi\phi^\top$ over all pairs $(x_i,y_k)$, which mimics sampling from the product of the marginals. $\hat h$ is the average of $\phi$ over the matched pairs $(x_i,y_i)$, and $\lambda$ is a ridge penalty. The held-out score on fold $v$ is
$$ J_v(\mathbf a, b,\lambda)=\tfrac12\,\hat\alpha^\top \hat H_v\,\hat\alpha-\hat h_v^\top\hat\alpha , $$
where $\hat H_v$ and $\hat h_v$ are computed on the held-out fold. $J_v$ is the held-out squared error of the density-ratio fit up to a constant, and lower is better. Every term is a smooth function of $\log a_j$, so the gradient of the fold-averaged score follows from the chain rule through a single $B\times B$ linear solve, where $B$ is the number of basis functions. The per-step cost is $O(nB^2+B^3+dnB)$, compared with $O(G^d)$ for a grid of $G$ values per feature.
Research Program
We will first build the estimator. It optimizes $\log\mathbf a$, $\log b$ and $\log\lambda$ by L-BFGS, a standard quasi-Newton optimizer, on a K-fold average of $J_v$, starting from the $\text{HSIC}_{\text{CV}}$ scalar solution. A mild penalty $\gamma\sum_j(\log a_j-\overline{\log a})^2$ pulls the widths toward a common value. At $\gamma\to\infty$ the method reduces exactly to scalar LSMI cross-validation, so the learned-scale method strictly contains the published baseline. The strength $\gamma$ is itself picked by an outer held-out fold.
The second component is test validity, which is the part most easily gotten wrong. Tuning $d$ widths on the same data that is then permuted would bias the null distribution. The primary protocol therefore learns $(\mathbf a,b)$ on one half of the data. It then runs a permutation HSIC test, which uses the HSIC–LSMI link to carry the widths over, on the other half. For small $n$ we will also evaluate a costlier variant that repeats the tuning inside every permutation. This measures how much power the split sacrifices.
The third component is analysis. For a single nuisance feature, the expected score gradient with respect to its $\log a_j$ can be written in closed form. We will check that it pushes $a_j$ toward zero when that feature is independent of both $y$ and the informative features. This would give a mechanism, not just an observation, for why learned scales discard noise that unit-variance scaling cannot.
Two applications follow. The first plugs the learned per-feature widths into HSIC Lasso in place of per-feature medians. This addresses the gap flagged in Effective Nonlinear Feature Selection Method based on HSIC Lasso and with Variational Inference and tests whether spurious small weights on noise features disappear. The second extends LSIR to multivariate causes, where the regression kernel and the independence kernel each get per-feature widths.
Baselines
The naive reference point is the median trick on z-scored features ($\text{HSIC}_{\text{med}}$). It is what most practitioners run, and it is used by the ANM-HSIC variants in Distinguishing Cause from Effect Using Observational Data: Methods and Benchmarks. We run it on identical splits and permutation counts.
The strongest existing competitor for testing is $\text{HSIC}_{\text{CV}}$ with a scalar width tuned by LSMI cross-validation on z-scored data, from On Kernel Parameter Selection in Hilbert-Schmidt Independence Criterion. It uses the same objective and differs only in dimensionality, so any gain is attributable to per-feature scaling. That paper reports its advantage over the median trick qualitatively ("significantly outperforms", "closely tracks" full $\text{LSMI}_{\text{CV}}$). It also reports a relative cost of roughly 9 times the median trick. It gives no numeric rejection rate, so for this baseline there is no reported numeric power result found on Lacuna. We will reimplement it, confirm it reproduces the qualitative ordering, and give it the same data split and a wall-clock budget matched to ours. Beating it means higher rejection rate at the same false-positive rate on the rotated mixture with added nuisance features. It also means not losing, within Monte Carlo error, when no nuisance features exist.
For causal discovery the reference is scalar-width LSIR, which reports 49 of 80 correct pairs and a 0.77 identification rate under a strict threshold, versus 31 and 0.48 for HSIC regression (Least-squares independence regression for non-linear causal inference under non-Gaussian noise). The broader benchmark reports ANM accuracies of 63% to 85% and ANM-PHSIC at 63% ± 10% accuracy with 0.74 ± 0.05 AUC (Distinguishing Cause from Effect Using Observational Data: Methods and Benchmarks).
For feature selection the reference is HSIC Lasso with median widths. It is reported at nearly 100% selection accuracy on non-additive synthetic data (High-Dimensional Feature Selection by Feature-Wise Non-Linear Lasso), which leaves headroom only in harder regimes. The variational version identified the correct set in 15 of 30 runs on its Data1 (Effective Nonlinear Feature Selection Method based on HSIC Lasso and with Variational Inference).
Three ablations isolate the key ingredient. The first learns per-feature widths by maximizing the HSIC statistic on the training half instead of minimizing held-out $J$. This tests whether a held-out validation criterion matters, or whether any dependence-maximizing objective would do. The second uses random per-feature widths matched in spread to the learned ones, which tests whether a gain is simply due to breaking isotropy. The third sets $\gamma=\infty$, which recovers the scalar baseline inside our code path.
Why not just…?
Why not just z-score every feature and tune one width? Z-scoring equalizes variances, not relevance. After standardization a pure-noise feature contributes as much to the distance as the informative one. The multi-bandwidth analysis in Anisotropic function estimation using multi-bandwidth Gaussian processes shows that a single width is rate-suboptimal even on common domains. In our design this alternative is exactly the $\text{HSIC}_{\text{CV}}$ baseline. If the learned scales fail to beat it once nuisance features are present, the proposal fails.
Why not just use per-feature median widths, as HSIC Lasso does? A per-feature median adapts to each feature's spread but ignores whether the feature relates to the other variable. A noise feature gets a perfectly sensible width and so keeps its full weight. The HSIC Lasso comparison tests this directly: we swap median widths for learned widths and count noise features receiving non-zero weight.
Why not just learn lengthscales by Gaussian-process marginal likelihood (automatic relevance determination) and reuse them? This is the most serious threat, because it is cheap, standard, and already per-feature. Its weakness is that it only sees dependence through the conditional mean of $y$ given $x$. In the rotated Gaussian mixture, and in variance-only or multimodal dependence, the conditional mean can be nearly flat. Relevance determination then shrinks the very features that carry the dependence. We will include it as a baseline, fit on the same training half, on both mean-type and mean-free dependence. We expect it to match our method on mean-type dependence and to lose on mean-free dependence. If it matches on both, we will report that the simpler tool suffices and restrict our claim to the causal residual setting.
Why not just search a grid over per-feature widths? A grid needs $G^d$ evaluations, which is already about $10^{10}$ for ten features and ten values each. We will run it only at $d=2,3$ as a check that gradient descent reaches the grid optimum of $J$.
Proposed Experiments
The primary benchmark is the rotated Gaussian mixture of On Kernel Parameter Selection in Hilbert-Schmidt Independence Criterion, with rotation angle from 0 to $\pi/8$. We extend it with $m\in\{0,2,8,32\}$ unit-variance nuisance features appended to $x$, and separately with informative features of differing smoothness. We report rejection rate at level 0.05 over 500 repetitions per setting, the false-positive rate at angle zero, and wall-clock time relative to $\text{HSIC}_{\text{med}}$.
The decisive check has two parts. At $m=0$ the learned method should be indistinguishable from $\text{HSIC}_{\text{CV}}$. As $m$ grows, its power should decay much more slowly than both baselines, with the false-positive rate staying within binomial error of 0.05 under the split protocol. A false-positive rate above nominal in the no-split variant would confirm that the split is necessary. Power no better than the random-width ablation would falsify the mechanism.
For feature selection we use the Gas Sensor (128 features) and USPS (256 features) datasets from the variational HSIC Lasso study, plus the non-additive synthetic tasks with added noise features. We measure the fraction of noise features with non-zero weight and downstream classification accuracy.
For causal discovery we rerun LSIR with learned widths on the 80 real pairs, and on the multivariate pairs of the benchmark in Distinguishing Cause from Effect Using Observational Data: Methods and Benchmarks. On bivariate pairs we expect little change and treat not falling below 49 of 80 as a non-regression check. The real test is on multivariate causes, compared with scalar LSIR at matched compute. Finally, we plot the learned widths on the E. coli regulatory data to see whether they align with known links. This serves as a qualitative plausibility check, not a headline result.
References
- On Kernel Parameter Selection in Hilbert-Schmidt Independence Criterion
- Least-squares independence regression for non-linear causal inference under non-Gaussian noise
- Anisotropic function estimation using multi-bandwidth Gaussian processes
- Adaptive Scaling for Feature Selection in SVMs
- Variational Metric Scaling for Metric-Based Meta-Learning
- High-Dimensional Feature Selection by Feature-Wise Non-Linear Lasso
- Effective Nonlinear Feature Selection Method based on HSIC Lasso and with Variational Inference
- Distinguishing Cause from Effect Using Observational Data: Methods and Benchmarks