nirs4all.operators.augmentation.random module

class nirs4all.operators.augmentation.random.Random_X_Operation(operator_func=<built-in function mul>, operator_range=(0.97, 1.03), random_state=None)[source]

Bases: TransformerMixin, BaseEstimator

Class for applying random operation on data augmentation.

Parameters:
  • 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).

  • random_state (int or None, optional) – Random seed for reproducibility. Default is None.

fit(X, y=None, **kwargs)[source]
transform(X, **kwargs)[source]

Transform the data by applying random operation.

Parameters:

X (ndarray) – Input data to be transformed.

Returns:

Transformed data.

Return type:

ndarray

class nirs4all.operators.augmentation.random.Rotate_Translate(p_range=2, y_factor=3, random_state=None)[source]

Bases: TransformerMixin, BaseEstimator

Class for rotating and translating data augmentation.

Vectorized implementation that processes all samples in batch.

Parameters:
  • 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.

  • random_state (int or None, optional) – Random seed for reproducibility. Default is None.

fit(X, y=None, **kwargs)[source]
transform(X, **kwargs)[source]

Transform the data by rotating and translating the signal.

Vectorized implementation using NumPy broadcasting.

Parameters:

X (ndarray) – Input data to be transformed, shape (n_samples, n_features).

Returns:

Transformed data.

Return type:

ndarray