nirs4all.operators.augmentation.random module
- class nirs4all.operators.augmentation.random.Random_X_Operation(apply_on='global', random_state=None, *, copy=True, operator_func=<built-in function mul>, operator_range=(0.97, 1.03))[source]
Bases:
AugmenterClass for applying random operation on data augmentation.
- Parameters:
apply_on (str, optional) – Apply augmentation on “features” or “samples” data. Default is “features”.
random_state (int or None, optional) – Random seed for reproducibility. Default is None.
copy (bool, optional) – If True, creates a copy of the input data. Default is True.
operator_func (function, optional) – Operator function to be applied. Default is operator.mul.
operator_range (tuple, optional) – Range for generating random values for the operator. Default is (0.97, 1.03).
- class nirs4all.operators.augmentation.random.Rotate_Translate(apply_on='samples', random_state=None, *, copy=True, p_range=2, y_factor=3)[source]
Bases:
AugmenterClass for rotating and translating data augmentation.
Vectorized implementation that processes all samples in batch.
- Parameters:
apply_on (str, optional) – Apply augmentation on “samples” or “global” data. Default is “samples”.
random_state (int or None, optional) – Random seed for reproducibility. Default is None.
copy (bool, optional) – If True, creates a copy of the input data. Default is True.
p_range (int, optional) – Range for generating random slope values. Default is 2.
y_factor (int, optional) – Scaling factor for the initial value. Default is 3.
- augment(X, apply_on='samples')[source]
Augment the data by rotating and translating the signal.
Vectorized implementation using NumPy broadcasting.
- Parameters:
X (ndarray) – Input data to be augmented, shape (n_samples, n_features).
apply_on (str, optional) – Apply augmentation on “samples” or “global” data. Default is “samples”.
- Returns:
Augmented data.
- Return type:
ndarray