Skip to content

Instantly share code, notes, and snippets.

@andrea-dagostino
Last active August 6, 2022 17:42
Show Gist options
  • Select an option

  • Save andrea-dagostino/7987353e166fe18fa94979138cf7c24f to your computer and use it in GitHub Desktop.

Select an option

Save andrea-dagostino/7987353e166fe18fa94979138cf7c24f to your computer and use it in GitHub Desktop.
ts_clustering
N = 15 # window size --> possiamo modificare questo parametro per sperimentare
K = 0.70 # split size --> 70% dei dati è in A, 30% in B
SEQS = split_time_series(list(data['Close'].values), N) # crea sequenze di lunghezza N
SPLIT_SEQS = split_sequences(SEQS, K) # divide le sequenze in due
A = [seq[0] for seq in SPLIT_SEQS]
B = [seq[1] for seq in SPLIT_SEQS]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment