Static random augmentation across multiple time series
Opened this issue · 0 comments
jgrss commented
Hello,
I have a use case where I apply temporal augmentation with the same random anchor across multiple time series within a segmented object. I.e., I want certain augmentations to vary across objects, but remain constant within objects.
In TimeWarp
, e.g., I've added an optional keyword argument (static_rand
):
def __init__(
self,
n_speed_change: int = 3,
max_speed_ratio: Union[float, Tuple[float, float], List[float]] = 3.0,
repeats: int = 1,
prob: float = 1.0,
seed: Optional[int] = _default_seed,
static_rand: Optional[bool] = False
):
which is used by:
if self.static_rand:
anchor_values = rand.uniform(low=0.0, high=1.0, size=self.n_speed_change + 1)
anchor_values = np.tile(anchor_values, (N, 1))
else:
anchor_values = rand.uniform(
low=0.0, high=1.0, size=(N, self.n_speed_change + 1)
)
Thus, instead of having N
time series with different random anchor_values
, I generate N
time series with the same anchor value.
I use this approach with TimeWarp
and Drift
. Would this be of any interest as a PR, or does it sound too specific?
Thanks for the nice library.