chemometrics.mcr.constraint.ReplaceZeros¶
- class chemometrics.mcr.constraint.ReplaceZeros(axis=- 1, feature=None, fval=1, copy=False)¶
Bases:
Constraint
Samples that sum-to-zero across axis are replaced with a vector of 0’s except for a 1 at feature if a single value. In a concentration context, e.g., samples with no concentration are replaced with 100% concentration of a set feature. If multiple features given, equal amounts of each feature (summing to 1) are used.
- Parameters
axis (int) – Which axis of input matrix A to apply normalization acorss.
feature (int, list, tuple) –
- Set all samples which sum-to-zero across axis to fval for a particular
feature (or fractional) for multiple features.
fval (float) – Value of summation across axis of replacement vector.
copy (bool) – Make copy of input data, A; otherwise, overwrite (if mutable)
- __init__(axis=- 1, feature=None, fval=1, copy=False)¶
Replace sum-to-zero samples with new feature vector along axis
Methods
__init__
([axis, feature, fval, copy])Replace sum-to-zero samples with new feature vector along axis
transform
(A)Apply constraint
- transform(A)¶
Apply constraint