Created
August 12, 2015 04:27
-
-
Save christabor/10f141d6e276269e5f91 to your computer and use it in GitHub Desktop.
Random time series warping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randrange as rr | |
# Use with: http://mlpy.sourceforge.net/docs/3.5/dtw.html#id3 | |
def random_timesequence(start, end, steps=3): | |
seq = [] | |
for n in range(start, end): | |
# Randomize the number of sub-steps, | |
# but maintain the bounds and monotonicity | |
# (e.g. 0, 0, 1, 1, 1, 2, 3, 3, 3) | |
for i in range(rr(0, steps)): | |
seq.append(n) | |
return seq | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment