API Reference /

features/

Feature engineering and dimensionality reduction module.

The tuiml.features module provides a comprehensive set of tools for transforming, selecting, and extracting meaningful features from raw data. It follows the scikit-learn API pattern for transformations.

Module Overview

This module is organized into three main functional areas:

  1. Selection: Methods for identifying the most predictive subset of features.
  • Filter methods: VarianceThresholdSelector,
CFSSelector, etc.
  • Wrapper methods: SequentialFeatureSelector,
WrapperSelector, etc.
  1. Extraction: Methods for projecting data into a new, lower-dimensional space.
  • PCAExtractor: Principal Component Analysis.
  • RandomProjectionExtractor: Johnson-Lindenstrauss based reduction.
    1. Generation: Methods for constructing new features through mathematical combinations.
    2. PolynomialFeaturesGenerator: Feature interactions.
    3. BinningFeaturesGenerator: Discretization of continuous values.
    4. MathematicalFeaturesGenerator: Functional transformations.

Selecting top-k features using Correlation-based Feature Selection (CFS):

python
>>> from tuiml.features.selection import CFSSelector
>>> import numpy as np
>>> X, y = np.random.randn(50, 20), np.random.randint(0, 2, 50)
>>> selector = CFSSelector()
>>> X_selected = selector.fit_transform(X, y)
>>> print(f"Reduced to {X_selected.shape[1]} features")

Extracting principal components:

python
>>> from tuiml.features.extraction import PCAExtractor
>>> pca = PCAExtractor(n_components=0.95)
>>> X_pca = pca.fit_transform(X)

Packages