Skip to content

Instantly share code, notes, and snippets.

@derkzomer
Last active June 17, 2020 09:58
Show Gist options
  • Save derkzomer/cf4910fe254f5a052f49dd445a03ff0e to your computer and use it in GitHub Desktop.
Save derkzomer/cf4910fe254f5a052f49dd445a03ff0e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"steps = 50"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(26538, 50, 9)\n"
]
}
],
"source": [
"# Prepare the training data\n",
"x_train = []\n",
"y_train = []\n",
"\n",
"for i in range(steps, training_set_scaled.shape[0]-steps):\n",
" x_train.append(training_set_scaled[i-steps:i, :])\n",
" y_train.append(training_set_scaled[i, :])\n",
"\n",
"x_train, y_train = np.array(x_train), np.array(y_train)\n",
"print(x_train.shape)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(6611, 50, 9)\n"
]
}
],
"source": [
"# Prepare the test data\n",
"x_test = []\n",
"y_test = []\n",
"\n",
"for i in range(steps, test_set_scaled.shape[0]):\n",
" x_test.append(test_set_scaled[i-steps:i, :])\n",
" y_test.append(test_set_scaled[i, :])\n",
"\n",
"x_test, y_test = np.array(x_test), np.array(y_test)\n",
"print(x_test.shape)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment