kernel_features – Random Fourier features – approximate RBF kernel via random projection.#

Back to op axis | Back to L3 | Browse all options

Operational op under axis op, sub-layer L3_A_step_op, layer l3. Standalone callable: mf.functions.kernel_features_transform.

Function signature#

mf.functions.kernel_features_transform(
    panel: pd.DataFrame,
    kind: str enum {"rbf", "polynomial"},
    gamma: float,
) -> pd.DataFrame

Parameters#

name

type

default

constraint

description

panel

pd.DataFrame

Input panel. Each column is a variable; rows are time periods. Series is promoted to a single-column DataFrame internally.

kind

str enum {"rbf", "polynomial"}

'"rbf"'

Kernel type. ‘rbf’ for Gaussian kernel; ‘polynomial’ for degree-2 polynomial kernel.

gamma

float

1.0

> 0

Kernel bandwidth. For rbf: exp(-gamma *

Returns#

pd.DataFrame — scalar result.

Behavior#

sklearn RBFSampler: maps inputs to params.n_components random Fourier features whose dot product approximates the RBF kernel. Enables linear models to fit RBF-kernelised responses at training-set-size linear cost.

When to use

Kernel-augmented ridge / SVM at scale (n > 10k).

When NOT to use

Small-sample problems where exact kernel SVM is feasible.

In recipe context#

Set params.op = "kernel_features" in the relevant layer to activate this op within a recipe:

# Layer L3 recipe fragment
params:
  op: kernel_features

References#

  • macroforecast design Part 2, L3: ‘feature engineering is a DAG of typed transforms; cascade-depth bounds the longest chain at cascade_max_depth.’

  • Rahimi & Recht (2007) ‘Random Features for Large-Scale Kernel Machines’, NeurIPS.