Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static random augmentation across multiple time series #17

Open
jgrss opened this issue Dec 17, 2021 · 0 comments
Open

Static random augmentation across multiple time series #17

jgrss opened this issue Dec 17, 2021 · 0 comments

Comments

@jgrss
Copy link

jgrss commented Dec 17, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant