medium end_to_end

Data Augmentation

Implement deterministic data augmentation transforms for 1D signals.

Given a 1D signal, apply the following transforms based on the transform parameter:

  1. “flip”: Reverse the signal: [1,2,3] -> [3,2,1]
  2. “scale”: Multiply by a factor: signal * factor
  3. “shift”: Circular shift by amount positions to the right. Positive shifts to the right: [1,2,3,4], shift=1 -> [4,1,2,3]
  4. “noise”: Add a fixed noise pattern. Given a noise tensor, return signal + noise.

Input:

  • signal: 1D tensor of shape (L,)
  • transform: string, one of “flip”, “scale”, “shift”, “noise”
  • params: dict with transform-specific parameters:
    • flip: {} (no params)
    • scale: {“factor”: float}
    • shift: {“amount”: int}
    • noise: {“noise”: tensor of shape (L,)}

Output: Augmented signal of shape (L,).

Hints

data-augmentation preprocessing transforms pipeline
Detecting runtime...