habit.feature_preprocessing: scale voxel-feature matrices
Feature preprocessing for clustering inputs (voxel and supervoxel).
Two chains over one shared set of methods. The chains differ by whether their state crosses subject boundaries, not by what they process:
SubjectPreprocessingChain– stateless, per subject, usable at either granularity, removes between-subject variation.CohortPreprocessingChain– stateful, fitted on the training cohort, makes subjects comparable, state travels in the habitat model.
Distinguish this domain from table_preprocessor: that one preprocesses
the MODELLING table (one row per subject, with identifier and outcome
columns) on the way to an outcome model. This one preprocesses the CLUSTERING
input (one row per voxel or supervoxel) on the way to a habitat definition.
Chains speak plain DataFrame. The bridge to the typed contracts is the
symmetric pair feature_frame() / with_feature_frame() carried by both
VoxelFeatureField and
Supervoxelization, so a chain never needs to
know which one it is processing.
User guide: Habitat Guide Feature preprocessing · Habitat domain API. Component names: Habitat Spec component catalog.
Subject-level and cohort-level preprocessing of voxel / supervoxel feature matrices, composable into chains. This is not image preprocessing (Image preprocessing (bookmark)) and not table-ML preprocessing (Tabular ML (bookmark)).
Classes
Preprocess one subject's feature matrix using only that subject's data. |
|
Preprocess the pooled cohort feature matrix with fitted statistics. |
|
Stateless preprocessing of one subject's feature matrix. |
|
Stateful preprocessing of the pooled cohort feature matrix. |
|
Standardise features to zero mean and unit variance. |
|
Scale features to [0, 1]. |
|
Centre features on the median and scale by the interquartile range. |
|
Clip extreme values at tail quantiles instead of discarding them. |
|
Compress right-skewed features with |
|
Discretise features into ordinal bin indices. |
|
Replace non-finite feature values with a learned per-column statistic. |
|
Drop feature columns whose variance is at or below a threshold. |
|
Greedily drop redundant, highly correlated feature columns. |
|
Prior 2024 Spearman screen: signed r, p-value, keep the later column. |
|
Scale features by the maximum absolute value. |
|
Map each feature onto a uniform or normal distribution by percentile rank. |
|
Scale each row (voxel / supervoxel) to unit Euclidean length. |
|
Restrict the feature matrix to an explicit, externally derived list. |
|
Name-to-implementation registry for feature-matrix preprocessing methods. |
Functions
Instantiate preprocessing methods from their specifications. |