pretab.transformers.RBFExpansionTransformer

class pretab.transformers.RBFExpansionTransformer(output_dim=UNSET, gamma=1.0, target_aware=False, placement_strategy=UNSET, task='regression', adaptive=False, min_output_dim=UNSET, max_output_dim=UNSET, random_state=None)[source]

Bases: BaseCenterExpansion

Radial Basis Function (RBF) feature expansion for numerical tabular data.

This transformer expands each feature into a set of RBF (Gaussian) basis functions centered at fixed points. The centers can be determined either by a target-aware selector (based on supervised splits) or based on quantiles or uniform spacing.

Parameters:
  • output_dim (int, default=6) – Number of RBF centers (output columns) per feature.

  • gamma (float, default=1.0) – Width parameter of the RBF kernel. Larger values make the kernel narrower.

  • target_aware (bool, default=False) – Whether to place centers with a target-aware selector (requires y).

  • placement_strategy ({"cart", "lightgbm", "uniform", "quantile"}, optional) – Selector when target_aware=True ("cart" or "lightgbm"); spacing when target_aware=False ("uniform" or "quantile"). If left unset, resolves to "cart" on the target-aware path and "quantile" otherwise.

  • task ({"regression", "classification"}, default="regression") – Task type for the target-aware selector used to place centers.

  • adaptive (bool, default=False) – If True (with target_aware=True), the per-feature number of centers may vary within [min_output_dim, max_output_dim] instead of being fixed to output_dim. Has no effect on the quantile / uniform paths.

  • min_output_dim (int or None, default=None) – Lower bound on the per-feature number of centers in adaptive mode.

  • max_output_dim (int or None, default=None) – Upper bound on the per-feature number of centers in adaptive mode.

  • random_state (int or None, default=None) – Random state forwarded to the target-aware selector for reproducibility.

Variables:
  • centers (list of ndarray) – List of arrays containing center locations for each feature.

  • total_output_dim (int) – Total number of output columns across all features (fitted).

Notes

For a feature \(x\) and centers \(c_i\), each output column is a Gaussian radial basis function

\[\phi_i(x) = \exp\left(-\gamma (x - c_i)^2\right),\]

producing output_dim new features per original feature on the non-target-aware path; the target-aware default may place a data-driven number.

Examples

>>> import numpy as np
>>> from pretab.transformers import RBFExpansionTransformer
>>> X = np.array([[1.0], [2.0], [3.0]])
>>> transformer = RBFExpansionTransformer(output_dim=3, gamma=0.5, target_aware=False, placement_strategy="uniform")
>>> transformer.fit(X)
RBFExpansionTransformer(...)
>>> transformer.transform(X).shape
(3, 3)
__init__(output_dim=UNSET, gamma=1.0, target_aware=False, placement_strategy=UNSET, task='regression', adaptive=False, min_output_dim=UNSET, max_output_dim=UNSET, random_state=None)[source]

Methods

__init__([output_dim, gamma, target_aware, ...])

fit(X[, y])

Place per-feature centers from a target-aware selector or quantile/uniform spacing.

fit_transform(X[, y])

Fit to data, then transform it.

get_feature_names_out([input_features])

Return output feature names of the form {feature}_{suffix}{j}.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Expand every feature against its centers and stack the results.

Attributes

total_output_dim_

Total number of output columns produced across all input features.

centers_

n_features_in_

adaptive