---
title: Pairwise KAN Matrix (PKAN)
url: https://www.emergentmind.com/topics/pairwise-kan-matrix-pkan
type: topic
---

# Pairwise KAN Matrix (PKAN)

The Pairwise KAN Matrix (PKAN) is a matrix-based tool for quantifying and visualizing nonlinear associations between ordered pairs of variables in a dataset. Derived from the theoretical foundations of the Kolmogorov–Arnold representation theorem and implemented using the Kolmogorov–Arnold Network (KAN) architecture, PKAN provides a color-coded summary of both the strength and the explicit functional form of each pairwise relationship, thereby addressing the limitations of classical linear and information-theoretic association measures [2512.15755].

## 1. Theoretical Foundation

PKAN is grounded in the Kolmogorov–Arnold representation theorem, which asserts that any continuous multivariate function $f(x_1,\ldots,x_n)$ can be written as a finite superposition of continuous univariate functions:
$$
f(x_1,\ldots,x_n) = \sum_{i=1}^{2n+1} \Phi_i \left( \sum_{j=1}^n \phi_{ij}(x_j) \right)
$$
where $\phi_{ij}:\mathbb{R}\rightarrow\mathbb{R}$ and $\Phi_i:\mathbb{R}\rightarrow\mathbb{R}$ are continuous functions. The KAN architecture provides a parametric, learnable analogue to these $\phi_{ij}$ and $\Phi_i$ functions, typically using spline-based single-layer neural networks and training via standard prediction losses such as mean squared error.

PKAN specifically utilizes a simplified KAN, omitting the outer $\Phi_i$ layer and learning only a single univariate mapping for each input–target pair. The learned mapping $P_{ij}(\cdot)\approx \phi_{ij}(\cdot)$ characterizes the predictive relationship and the form of nonlinearity between $x_j$ and $x_i$.

## 2. Formal Definition

Given a set of $n$ variables $X = \{x_1,\ldots,x_n\}$, PKAN constructs an $n \times n$ matrix where each entry $(i, j)$ encodes the fit of a single-input single-output network predicting $x_i$ from $x_j$:
$$
\hat{y}_{i|j}(t) = P_{ij}\left(x_j(t)\right)
$$
Two outputs are obtained from each fit:
- **Functional form**: The learned univariate $P_{ij}$, representing the explicit relationship.
- **Association strength**: A normalized scalar $S_{ij} \in [0,1]$ quantifying the degree to which $x_j$ predicts $x_i$.

Strength calculation involves:
- Computing prediction loss $L_{ij}$ (e.g., MSE) on held-out data.
- Converting $L_{ij}$ to a predictive strength score using the Nash–Sutcliffe Efficiency (NSE) or similar:
  $$
  \rho_{ij} = 1 - \frac{ \sum_t ( x_i(t) - \hat{y}_{i|j}(t) )^2 }{ \sum_t ( x_i(t) - \bar{x}_i )^2 }
  $$
- Estimating the KAN attribute score $A_{ij}$ as the ratio of standard deviation of activation through $P_{ij}$ to the total at the node.
- Calculating raw strength $R_{ij} = \rho_{ij} \cdot A_{ij}$.
- Rescaling $R_{ij}$ for all pairs to $[0,1]$:
  $$
  S_{ij} = \frac{R_{ij} - \min R}{\max R - \min R}
  $$
with $S_{ii}=1$ for diagonal elements.

## 3. Algorithmic Construction

PKAN computation follows these steps:

1. **Preprocessing**: Optionally normalize each variable to $[0,1]$.
2. **Model fitting**: For each ordered pair $(i,j)$ with $i \neq j$, fit a univariate KAN mapping $x_j \mapsto x_i$ via mean squared error minimization.
3. **Output computation**:
   - Evaluate $\rho_{ij}$ on held-out data.
   - Compute $A_{ij}$ as per Liu et al.
   - Obtain $R_{ij} = \rho_{ij} \cdot A_{ij}$.
4. **Normalization**: Transform $R_{ij}$ to $S_{ij}$ as above.
5. **Storage**: Record $S_{ij}$ and the learned curve $P_{ij}$ (sampled over a grid) for visualization.

The diagonal $S_{ii}$ is set to $1$ and the identity function is stored for reference.

### Algorithm Pseudocode (from [2512.15755])

| Step        | Operation                              | Output                      |
|-------------|----------------------------------------|-----------------------------|
| Preprocess  | Normalize $x_j$ (optional)             | Normalized variables        |
| KAN Fit     | Train $P_{ij}$ for $(i, j)$            | Parameters $\theta_{ij}$    |
| Evaluate    | Compute $\rho_{ij}, A_{ij}$            | Raw strength $R_{ij}$       |
| Normalize   | Convert $R_{ij}$ to $S_{ij}$           | PKAN matrix $S$             |
| Visualize   | Store $P_{ij}$ curves                  | Heatmap overlay             |

## 4. Visualization and Interpretation

PKAN is rendered as an $n \times n$ color-coded matrix:
- **Rows $i$**: target variables $x_i$
- **Columns $j$**: input variables $x_j$
- **Cell $(i, j)$**: color encodes $S_{ij}$ (white for $0$, dark red for $1$); a curve is overlaid to show $P_{ij}(x_j)$

Interpreting a cell:
- **Color intensity (magnitude)** indicates how strongly $x_j$ alone predicts $x_i$
- **Curve shape (form)** reveals monotonicity, nonlinearity, symmetry, or injectivity
- **Directional asymmetry** is manifest as $S_{ij} \neq S_{ji}$ except for mutually injective mappings

## 5. Comparative Evaluation with Classical Metrics

PKAN provides a richer characterization compared to standard association measures:
- **Pearson correlation $\rho_P$**: Captures only linear, symmetric dependence; fails for nonlinear monotonic relationships (e.g., $x \to x^2$ on symmetric domains with $\rho_P \approx 0$).
- **Mutual information $I(x; y)$**: Detects nonlinearity and is symmetric, but unable to represent directionality or explicit function shape, and becomes computationally challenging as $n$ increases.
- **PKAN**: Encodes strength (asymmetrically), explicit function form, and directionality. It remains robust to collinearity by isolating each predictor.

Empirical demonstrations include:
- **Quadratic/cubic**: PKAN captures $x \to x^2$, $x \to x^3$ accurately in strength and learned curve; Pearson and MI miss essential features.
- **Heteroscedastic noise**: PKAN scores track Pearson but with curve shape reflecting the true underlying relation.
- **Lagged sinusoids**: PKAN recognizes cyclic structure and directionality, which Pearson and MI cannot fully recover.

PKAN thus provides both an interpretable score of association and direct visualization of the relationship, serving as a tool for pre-processing (feature selection, redundancy analysis), post-processing (model explanation), and discovery of physical patterning in data [2512.15755].

## 6. Applications and Broader Significance

PKAN supports multiple stages in the model development workflow:
- **Exploratory data analysis**: Rapid assessment of all pairwise relationships in high-dimensional data.
- **Feature selection and redundancy analysis**: Identification of inputs with non-trivial, possibly nonlinear predictive value.
- **Physical insight**: Visualization of explicit functional forms to guide scientific hypothesis formation.
- **Model explanation**: Post hoc interrogation of black-box models via analogous association patterns.

Case studies, such as analysis on the CAMELS hydrology dataset and large-eddy simulations of river flow, corroborate the robustness, informativeness, and interpretability advantages of PKAN over prior approaches [2512.15755].

*Plausible implications*: The combined strength-and-form rendering aids in domain-informed modeling and hypothesis-driven discovery, particularly under high-dimensional and collinear regimes where conventional statistics may obscure essential structure.

Source: https://www.emergentmind.com/topics/pairwise-kan-matrix-pkan