Feature Engineering

Aggregator

FeatureEngineering

__init__(dataset)

reset()

fe_bivector(features: Union[str, Tuple]=None, dataset: str='main', max_features: int=300, selection: str='variance')

fe_wedge_bivector(features: Union[str, Tuple]=None, dataset: str='main', max_features: int=300, selection: str='variance')

fe_whitening(features: Union[str, Tuple]=None, dataset: str='main', regularization: float=1e-08)

fe_shear(features: Union[str, Tuple]=None, dataset: str='main', threshold: float=0.0)

fe_grade_ratio(features: Union[str, Tuple]=None, dataset: str='main', max_triplets: int=50, regularization: float=1e-08)

fe_multi_grade_shape(features: Union[str, Tuple]=None, dataset: str='main', grades: List[int]=None, n_bins: int=5, regularization: float=1e-08)

fe_density(features: Union[str, Tuple]=None, dataset: str='main', bandwidth: Union[str, float]='median', n_reference: int=500, log_density: bool=True)

fe_blade_spectrum(features: Union[str, Tuple]=None, dataset: str='main', n_neighbors: int=10)

fe_rf_proximity(features: Union[str, Tuple]=None, dataset: str='main', n_estimators: int=100, max_depth: int=6, n_landmarks: int=50)

fe_spectral_proximity(features: Union[str, Tuple]=None, dataset: str='main', n_estimators: int=100, max_depth: int=6, n_components: int=10)

fe_direct_rs(features: Union[str, Tuple]=None, dataset: str='main', n_estimators: int=50, max_depth: int=4, regularization: float=1e-08)

fe_phase_encoder(features: Union[str, Tuple]=None, dataset: str='main', n_thresholds: int=5, include_original: bool=False)

fe_kinematics(features: Union[str, Tuple]=None, dataset: str='main', n_timesteps: int=None, n_features_per_step: int=None)

engineer_one_step(data, step)

engineer(data)

transform(data)

save(path_or_buf)

load(path_or_buf)

get_status()

FEBivector

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', max_features: int=300, selection: str='variance')

Generates grade-2 bivector features (pairwise feature products).

For each pair (i, j) with i < j, computes B_ij = X_i * X_j. This captures pairwise nonlinear interactions based on Geometric Algebra wedge products.

Parameters

features : str or tuple, default=None
Features to use for bivector computation. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

max_features : int, default=300
Maximum number of bivector features to generate.

selection : {“all”, “random”, “variance”}, default=“variance”
How to select pairs if max_features < C(n,2):

  • “all”: use all pairs (ignore max_features)
  • “random”: random selection
  • “variance”: highest variance pairs

FEWedgeBivector

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', max_features: int=300, selection: str='variance')

Generates wedge-weighted pairwise feature products.

Suppresses nearly-collinear pairs and amplifies orthogonal ones by weighting each product X_i * X_j by the column-level sin(angle) between features i and j.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

max_features : int, default=300
Maximum number of pairs to generate.

selection : {“variance”, “random”}, default=“variance”
Pair selection method if max_features < C(d,2).

FEWhitening

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', regularization: float=1e-08)

Applies rotor whitening (GA Mahalanobis transformation).

Aligns data with principal axes using SVD-based whitening:
X’ = (X - mu) @ V @ diag(1/sigma)

Parameters

features : str or tuple, default=None
Features to whiten. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

regularization : float, default=1e-8
Regularization for variance computation.

FEShear

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', threshold: float=0.0)

Applies pairwise shear (decorrelation via residualization).

For each feature pair (i, j): X_i’ = X_i - beta_ij * X_j, where beta_ij = cov(X_i, X_j) / var(X_j).

Parameters

features : str or tuple, default=None
Features to decorrelate. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

threshold : float, default=0.0
Only apply shear if |beta_ij| > threshold.

FEGradeRatio

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', max_triplets: int=50, regularization: float=1e-08)

Generates grade-ratio shape feature measuring 3-way vs 2-way interaction complexity.

After whitening, computes ratio E3/E2 where E2 is summed pairwise blade energy and E3 is summed triplet blade energy. High ratio = dominant 3-body structure.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

max_triplets : int, default=50
Maximum number of sampled triplets for E3 estimation.

regularization : float, default=1e-8
Regularization for the internal whitening step.

FEMultiGradeShape

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', grades: List[int]=None, n_bins: int=5, regularization: float=1e-08)

Generates multi-grade shape features (context distances using grades 2-4).

Computes Mahalanobis (grade 2), skewness-weighted (grade 3), and kurtosis-weighted (grade 4) distances to class or quantile-bin centroids. Requires a target variable.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

grades : list of int, default=None
Which grades to include (2, 3, and/or 4). Defaults to [2].

n_bins : int, default=5
Number of bins for regression (uses quantiles).

regularization : float, default=1e-8
Regularization for covariance inversion.

FEDensity

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', bandwidth: Union[str, float]='median', n_reference: int=500, log_density: bool=True)

Generates RBF kernel density feature per sample.

Computes mean RBF similarity to a reference subset of training points, yielding a scalar density estimate per row.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

bandwidth : str or float, default=“median”
If ‘median’, sigma = median(pairwise_dists) / sqrt(2*log(2)). If float, use directly as sigma.

n_reference : int, default=500
Number of reference points subsampled from training data.

log_density : bool, default=True
If True, return log(density + 1e-10), else return density directly.

FEBladeSpectrum

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', n_neighbors: int=10)

Generates local blade energy spectrum features from k-NN neighborhood.

For each sample, queries k nearest neighbors in whitened space and computes grade 1/2/3 blade energies, normalized proportions, spectral slope, and dominant grade.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

n_neighbors : int, default=10
Number of nearest neighbors (k).

FERFProximity

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', n_estimators: int=100, max_depth: int=6, n_landmarks: int=50)

Generates RF leaf co-occurrence proximity features via Nystrom approximation.

Trains a random forest and uses its leaf co-occurrence as a similarity kernel. The Nystrom method computes a fixed-width feature map from landmark points. Requires a target variable.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

n_estimators : int, default=100
Number of trees in the forest.

max_depth : int, default=6
Maximum tree depth.

n_landmarks : int, default=50
Number of Nystrom anchor points.

FESpectralProximity

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', n_estimators: int=100, max_depth: int=6, n_components: int=10)

Generates spectral embedding features from RF proximity kernel.

Builds the RF proximity matrix, computes the normalized graph Laplacian, and extracts the smoothest eigenvectors as features. Uses Nystrom extension at transform time. Requires a target variable.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

n_estimators : int, default=100
Number of trees in the forest.

max_depth : int, default=6
Maximum tree depth.

n_components : int, default=10
Number of spectral components.

FEDirectRS

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', n_estimators: int=50, max_depth: int=4, regularization: float=1e-08)

Generates DirectRS stretch features from random forest leaf geometry.

Builds a weighted outer-product matrix from per-leaf centroids and variances, decomposes via eigendecomposition, and applies the resulting stretch matrix. Requires a target variable.

Parameters

features : str or tuple, default=None
Features to use. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

n_estimators : int, default=50
Number of trees in the forest.

max_depth : int, default=4
Maximum tree depth.

regularization : float, default=1e-8
Regularization added to diagonal of G before eigendecomposition.

FEPhaseEncoder

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', n_thresholds: int=5, include_original: bool=False)

Generates smooth threshold-proximity encoding via phase differences.

For each feature, learns percentile thresholds and encodes each value as its cosine similarity to each threshold in normalized phase space. Avoids hard binning.

Parameters

features : str or tuple, default=None
Features to encode. If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

n_thresholds : int, default=5
Number of threshold points per feature (evenly spaced percentiles).

include_original : bool, default=False
If True, prepend original features to output.

FEKinematics

__init__(dataset)

transform(data)

run(features: Union[str, Tuple]=None, dataset: str='main', n_timesteps: int=None, n_features_per_step: int=None)

Generates velocity, acceleration, and kinematic summary features from temporal sequences.

Extracts kinematic quantities from multi-step time series data: last velocity, last acceleration, mean speed, kinetic energy, and directional persistence.

Parameters

features : str or tuple, default=None
Features to use (treated as flat temporal sequence). If None, all numerical features are used.

dataset : {“main”, “train”, “test”}, default=“main”
Dataset used to fit the transformer.

n_timesteps : int, default=None
Number of time steps. If None, inferred from data.

n_features_per_step : int, default=None
Features per time step. If None, inferred from data.