immuneML.encodings.preprocessing package
Submodules
immuneML.encodings.preprocessing.FeatureScaler module
- class immuneML.encodings.preprocessing.FeatureScaler.FeatureScaler[source]
Bases:
object
- SKLEARN_NORMALIZATION_TYPES = ['l1', 'l2', 'max']
- static normalize(design_matrix, normalization_type: NormalizationType)[source]
Normalize on example level so that the norm type applies to compute values like frequency
- Parameters:
design_matrix – rows -> examples, columns -> features
normalization_type – l1, l2, max, binary, none
- Returns:
normalized design matrix
- static standard_scale(scaler, design_matrix, with_mean: bool = True)[source]
Scale to zero mean and unit variance on feature level
- Parameters:
scaler – already fitted scaler object that has function transform
design_matrix – rows -> examples, columns -> features
with_mean – whether to scale to zero mean or not (could lose sparsity if scaled)
- Returns:
scaled design matrix
- static standard_scale_fit(scaler, design_matrix, with_mean: bool = True)[source]
Scale to zero mean and unit variance on feature level
- Parameters:
scaler – scaler object that has function fit_transform
design_matrix – rows -> examples, columns -> features
with_mean – whether to scale to zero mean or not (could lose sparsity if scaled)
- Returns:
scaled design matrix