Experiments#

Typical Variation Normalizer#

class experiments.tvn.TypicalVariationNormalizer(eps=1e-08)[source]#

Bases: object

Implements Typical Variation Normalization (TVN) as a preprocessing step for feature vectors.

TVN is commonly used in bioimage analysis to reduce batch effects and normalize features relative to a control group (typically DMSO-treated images). It uses PCA to capture dominant variation modes and whitens the features.

mean_#

Mean vector of the DMSO features computed during PCA fitting.

Type:

torch.Tensor

components_#

Principal components (eigenvectors) from PCA.

Type:

torch.Tensor

whiten#

If True, uses PCA whitening during fitting.

Type:

bool

eps#

Small epsilon value to ensure numerical stability.

Type:

float

__init__(eps=1e-08)[source]#
fit(dmso_features: Tensor)[source]#

Fits the PCA model on the given DMSO feature set, storing the mean and components.

transform(features: Tensor) Tensor[source]#

Applies TVN to a set of input features using the fitted PCA model, returning the whitened and decorrelated features.