Skip to content

Instantly share code, notes, and snippets.

@curiousily
Created April 23, 2020 19:40
Show Gist options
  • Save curiousily/07f907ee19778f0a042b394a93a03596 to your computer and use it in GitHub Desktop.
Save curiousily/07f907ee19778f0a042b394a93a03596 to your computer and use it in GitHub Desktop.
def create_dataset(X, y, time_steps=1, step=1):
Xs, ys = [], []
for i in range(0, len(X) - time_steps, step):
v = X.iloc[i:(i + time_steps)].values
labels = y.iloc[i: i + time_steps]
Xs.append(v)
ys.append(stats.mode(labels)[0][0])
return np.array(Xs), np.array(ys).reshape(-1, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment