Skip to content

Instantly share code, notes, and snippets.

@NateWeiler
Created June 12, 2020 06:45
Show Gist options
  • Save NateWeiler/1da672af936f5c4fe40314bd563af782 to your computer and use it in GitHub Desktop.
Save NateWeiler/1da672af936f5c4fe40314bd563af782 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(1000, 20)\n"
]
}
],
"source": [
"# Predict using testing set\n",
"\n",
"dataset_total = pd.concat((train, test), axis = 0)\n",
"inputs = dataset_total[len(dataset_total) - len(test) - batch_size:].values\n",
"inputs = inputs.reshape(-1,1)\n",
"inputs = sc.transform(inputs)\n",
"x_test = []\n",
"prediction_window = 1000\n",
"for i in range(batch_size, batch_size+prediction_window):\n",
" x_test.append(inputs[i-batch_size:i, 0])\n",
"x_test = np.array(x_test)\n",
"print(x_test.shape)\n",
"x_test = np.reshape(x_test, (x_test.shape[0], x_test.shape[1], 1))\n"
]
},
{
"cell_type": "code",
"execution_count": 108,
"metadata": {},
"outputs": [],
"source": [
"y_hat = model.predict(x_test)\n",
"y_hat = sc.inverse_transform(y_hat)"
]
}
],
"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