Last active
October 19, 2019 20:35
-
-
Save alsrgv/02a65164285791ebcfc6c022468f6ca8 to your computer and use it in GitHub Desktop.
Tangent DL
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Problem statement" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"```\n", | |
" (x0, y0)\n", | |
"---------------->-----------*\n", | |
" alpha /\n", | |
" /\n", | |
" / \n", | |
" /\n", | |
" /\n", | |
" /\n", | |
" /\n", | |
" /\n", | |
"~~~~~~~~~~~~~~~~~~~*~~~~~~~~~~~~~~~~~~~~~~~~\n", | |
"(0, 0) (xt, 0)\n", | |
" \n", | |
"xt = x0 - y0 * tan(pi/2 - alpha), alpha = [0, pi)\n", | |
"```" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Generate input data" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def xt(x0, y0, alpha0, alpha):\n", | |
" return x0 - y0 * np.tan(alpha0 - alpha)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"N = 1000\n", | |
"x0 = 10.0\n", | |
"y0 = 10.0\n", | |
"alpha0 = np.pi/2\n", | |
"alphas = (np.random.rand(N) * 0.8 + 0.1) * np.pi\n", | |
"xts = xt(x0, y0, alpha0, alphas)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%matplotlib inline\n", | |
"import matplotlib.pyplot as plt" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Text(0.5,1,'Function plot')" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEICAYAAABcVE8dAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAGeVJREFUeJzt3X+wXOV93/H3R1dXVwK1ubLQ2OjHlUhM015l/Cu3FI9nOh7fmzFJHHBd1yVFFBlcwb3OFE87TUxwUic1rTOdcUzjGNBY2AraGlPsGNXFdRHBk/FMwBHEvwTBVggYSdjIGNlGAglJ3/6xZ9Fy2d97ztndcz6vmTva3XN2n+do4XMffc9znqOIwMzMim/JoDtgZmb5cOCbmZWEA9/MrCQc+GZmJeHANzMrCQe+mVlJOPDNFpF0s6TfG0C7j0uay7tdKw8Hvg2VJPSel/Rc3c/aDNvbKulr9a9FxDUR8V+yarNfkt4q6cCg+2GjZ+mgO2DWwG9ExJ5Bd8KsaDzCt5HQaFRbXwKR9GFJd0j6M0k/k7RP0kzdvhskfUHSYUnPSPqEpH8C3Ay8OfmXxJFk389I+kjde/+dpP2Sfixpd/2/OCSFpGskfU/SEUl/KklNjuHDku6U9Lmkjw9Jen2TfSckfVzSoeTn48lrZwNfBtbm8S8gKxYHvhXJxcDtwCSwG/gEgKQx4EvAE8AmYB1we0Q8AlwD/FVErIyIycUfKOltwH8D3gOcm3zG7Yt2ewfwT4HXJfu9vUUfLwH+F/Aq4H8CX5Q03mC/64ELgTcArwcuAD4UEUeBXwUOJX1eGRGHWrRn9hIHvg2jLyaj5SOSvtjF+74WEXdHxCng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FLpcAfxZV9wOTks7Np3fp6+B4CyUinoqIh5LHPwMeAdYt2q1o33Enx1xaDvwz1gFP1j0/QOP/UP5l8k/fOyVtyKdrA9Pp30mRvFnSNyV9WdLmQXcmLZI2AW8EHli0qbDfcYtjhoJ+z+048Lvzv4FNEfE64B5g54D7Y+l6iOqaJK8H/gT44oD7kwpJK4HPAx+IiJ8Ouj95aHPMhfyeO+HAP+MgUD9iX5+89pKIeCYijidPPwX8ck59G5S2fydFEhE/jYjnksd3A+OSzhlwt/oiaZxq8FUi4gsNdincd9zumIv4PXfKgX/GXwPnSzpP0jLgUmB3/Q6LapsXU60PFtlu4N8mMzkuBH4SEU8NulNZkfQaSUoeX0D1/49nBtur3iXHsgN4JCI+1mS3Qn3HnRxz0b7nboz+TcxTEhEnJf0W8BWqM3ZujYh9kv4Q2BsRu4F/L+li4CTVk39bB9bhFEj6LNUZC+dIOgD8Z2AcICJuBu6mOotjP3AMeO9gepqODo733cC8pJPA88ClkUzrGFFvAS4Hvi3pG8lrvwtMQTG/Yzo75qJ9zx3z0gpmZiXhko6ZWUk48M3MSsKBb2ZWEg58M7OScOCbmZWEA9/MrCQc+GZmJfH/AcKb4zw5BOWfAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"plt.plot(alphas, xts, 'ro')\n", | |
"plt.title('Function plot')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Build a dense model" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"Using TensorFlow backend.\n" | |
] | |
} | |
], | |
"source": [ | |
"import keras\n", | |
"from keras.models import Sequential\n", | |
"from keras.layers import Dense, Activation" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"model = Sequential([\n", | |
" Dense(1, input_shape=(1,), activation='sigmoid'),\n", | |
" Dense(1, activation='sigmoid'),\n", | |
" Dense(1, activation='sigmoid'),\n", | |
" Dense(1, activation='linear')\n", | |
"])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"model.compile(keras.optimizers.adam(0.01), 'mae')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": { | |
"scrolled": true | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Train on 500 samples, validate on 500 samples\n", | |
"Epoch 1/1000\n", | |
" - 1s - loss: 10.7925 - val_loss: 9.9397\n", | |
"Epoch 2/1000\n", | |
" - 1s - loss: 8.9296 - val_loss: 9.3375\n", | |
"Epoch 3/1000\n", | |
" - 1s - loss: 8.6620 - val_loss: 9.2013\n", | |
"Epoch 4/1000\n", | |
" - 1s - loss: 8.6035 - val_loss: 9.1835\n", | |
"Epoch 5/1000\n", | |
" - 1s - loss: 8.5911 - val_loss: 9.1167\n", | |
"Epoch 6/1000\n", | |
" - 1s - loss: 7.1363 - val_loss: 6.8368\n", | |
"Epoch 7/1000\n", | |
" - 1s - loss: 5.8644 - val_loss: 6.3118\n", | |
"Epoch 8/1000\n", | |
" - 1s - loss: 5.4597 - val_loss: 5.9684\n", | |
"Epoch 9/1000\n", | |
" - 1s - loss: 5.2467 - val_loss: 5.6347\n", | |
"Epoch 10/1000\n", | |
" - 1s - loss: 5.0600 - val_loss: 5.4765\n", | |
"Epoch 11/1000\n", | |
" - 1s - loss: 4.9672 - val_loss: 5.3055\n", | |
"Epoch 12/1000\n", | |
" - 1s - loss: 4.8163 - val_loss: 5.1971\n", | |
"Epoch 13/1000\n", | |
" - 1s - loss: 4.7217 - val_loss: 5.0519\n", | |
"Epoch 14/1000\n", | |
" - 1s - loss: 4.5931 - val_loss: 4.9358\n", | |
"Epoch 15/1000\n", | |
" - 1s - loss: 4.5099 - val_loss: 5.0212\n", | |
"Epoch 16/1000\n", | |
" - 1s - loss: 4.4456 - val_loss: 4.7371\n", | |
"Epoch 17/1000\n", | |
" - 1s - loss: 4.3692 - val_loss: 4.6615\n", | |
"Epoch 18/1000\n", | |
" - 1s - loss: 4.2757 - val_loss: 4.5659\n", | |
"Epoch 19/1000\n", | |
" - 1s - loss: 4.1710 - val_loss: 4.5181\n", | |
"Epoch 20/1000\n", | |
" - 1s - loss: 4.1445 - val_loss: 4.4309\n", | |
"Epoch 21/1000\n", | |
" - 1s - loss: 4.1202 - val_loss: 4.3754\n", | |
"Epoch 22/1000\n", | |
" - 1s - loss: 3.9930 - val_loss: 4.2898\n", | |
"Epoch 23/1000\n", | |
" - 1s - loss: 3.9569 - val_loss: 4.2762\n", | |
"Epoch 24/1000\n", | |
" - 1s - loss: 3.8951 - val_loss: 4.1311\n", | |
"Epoch 25/1000\n", | |
" - 1s - loss: 3.8637 - val_loss: 4.1126\n", | |
"Epoch 26/1000\n", | |
" - 1s - loss: 3.8115 - val_loss: 4.0311\n", | |
"Epoch 27/1000\n", | |
" - 1s - loss: 3.7506 - val_loss: 4.0511\n", | |
"Epoch 28/1000\n", | |
" - 1s - loss: 3.6890 - val_loss: 4.0650\n", | |
"Epoch 29/1000\n", | |
" - 1s - loss: 3.6750 - val_loss: 4.0656\n", | |
"Epoch 30/1000\n", | |
" - 1s - loss: 3.6083 - val_loss: 3.8089\n", | |
"Epoch 31/1000\n", | |
" - 1s - loss: 3.5777 - val_loss: 3.9468\n", | |
"Epoch 32/1000\n", | |
" - 1s - loss: 3.5322 - val_loss: 3.8944\n", | |
"Epoch 33/1000\n", | |
" - 1s - loss: 3.5142 - val_loss: 3.6922\n", | |
"Epoch 34/1000\n", | |
" - 1s - loss: 3.4402 - val_loss: 3.6803\n", | |
"Epoch 35/1000\n", | |
" - 1s - loss: 3.4512 - val_loss: 3.6076\n", | |
"Epoch 36/1000\n", | |
" - 1s - loss: 3.3729 - val_loss: 3.5536\n", | |
"Epoch 37/1000\n", | |
" - 1s - loss: 3.3810 - val_loss: 3.5800\n", | |
"Epoch 38/1000\n", | |
" - 1s - loss: 3.3545 - val_loss: 3.5162\n", | |
"Epoch 39/1000\n", | |
" - 1s - loss: 3.2678 - val_loss: 3.6007\n", | |
"Epoch 40/1000\n", | |
" - 1s - loss: 3.2645 - val_loss: 3.6501\n", | |
"Epoch 41/1000\n", | |
" - 1s - loss: 3.2485 - val_loss: 3.3819\n", | |
"Epoch 42/1000\n", | |
" - 1s - loss: 3.2319 - val_loss: 3.4298\n", | |
"Epoch 43/1000\n", | |
" - 1s - loss: 3.2518 - val_loss: 3.3201\n", | |
"Epoch 44/1000\n", | |
" - 1s - loss: 3.2345 - val_loss: 3.4718\n", | |
"Epoch 45/1000\n", | |
" - 1s - loss: 3.1643 - val_loss: 3.2942\n", | |
"Epoch 46/1000\n", | |
" - 1s - loss: 3.1669 - val_loss: 3.2535\n", | |
"Epoch 47/1000\n", | |
" - 1s - loss: 3.1319 - val_loss: 3.2573\n", | |
"Epoch 48/1000\n", | |
" - 1s - loss: 3.0872 - val_loss: 3.4586\n", | |
"Epoch 49/1000\n", | |
" - 1s - loss: 3.0787 - val_loss: 3.4577\n", | |
"Epoch 50/1000\n", | |
" - 1s - loss: 3.0466 - val_loss: 3.4527\n", | |
"Epoch 51/1000\n", | |
" - 1s - loss: 3.0726 - val_loss: 3.1633\n", | |
"Epoch 52/1000\n", | |
" - 1s - loss: 3.0663 - val_loss: 3.5573\n", | |
"Epoch 53/1000\n", | |
" - 1s - loss: 3.0855 - val_loss: 3.1189\n", | |
"Epoch 54/1000\n", | |
" - 1s - loss: 3.0575 - val_loss: 3.1009\n", | |
"Epoch 55/1000\n", | |
" - 1s - loss: 2.9985 - val_loss: 3.1468\n", | |
"Epoch 56/1000\n", | |
" - 1s - loss: 2.9711 - val_loss: 3.1504\n", | |
"Epoch 57/1000\n", | |
" - 1s - loss: 2.9657 - val_loss: 3.2312\n", | |
"Epoch 58/1000\n", | |
" - 1s - loss: 2.9622 - val_loss: 3.3062\n", | |
"Epoch 59/1000\n", | |
" - 1s - loss: 2.9618 - val_loss: 3.0904\n", | |
"Epoch 60/1000\n", | |
" - 1s - loss: 2.9455 - val_loss: 2.9928\n", | |
"Epoch 61/1000\n", | |
" - 1s - loss: 2.9392 - val_loss: 3.0355\n", | |
"Epoch 62/1000\n", | |
" - 1s - loss: 2.9007 - val_loss: 3.3310\n", | |
"Epoch 63/1000\n", | |
" - 1s - loss: 3.0090 - val_loss: 3.0556\n", | |
"Epoch 64/1000\n", | |
" - 1s - loss: 2.8749 - val_loss: 3.0421\n", | |
"Epoch 65/1000\n", | |
" - 1s - loss: 2.9156 - val_loss: 3.3153\n", | |
"Epoch 66/1000\n", | |
" - 1s - loss: 2.9068 - val_loss: 2.9724\n", | |
"Epoch 67/1000\n", | |
" - 1s - loss: 2.8824 - val_loss: 2.9063\n", | |
"Epoch 68/1000\n", | |
" - 1s - loss: 2.9851 - val_loss: 2.8933\n", | |
"Epoch 69/1000\n", | |
" - 1s - loss: 2.8765 - val_loss: 2.9933\n", | |
"Epoch 70/1000\n", | |
" - 1s - loss: 2.8790 - val_loss: 2.8743\n", | |
"Epoch 71/1000\n", | |
" - 1s - loss: 2.8289 - val_loss: 2.8723\n", | |
"Epoch 72/1000\n", | |
" - 1s - loss: 2.8650 - val_loss: 3.2131\n", | |
"Epoch 73/1000\n", | |
" - 1s - loss: 2.9271 - val_loss: 2.9211\n", | |
"Epoch 74/1000\n", | |
" - 1s - loss: 2.8302 - val_loss: 3.0967\n", | |
"Epoch 75/1000\n", | |
" - 1s - loss: 2.8432 - val_loss: 2.9141\n", | |
"Epoch 76/1000\n", | |
" - 1s - loss: 2.8195 - val_loss: 2.9590\n", | |
"Epoch 77/1000\n", | |
" - 1s - loss: 2.8431 - val_loss: 2.8571\n", | |
"Epoch 78/1000\n", | |
" - 1s - loss: 2.8409 - val_loss: 2.8092\n", | |
"Epoch 79/1000\n", | |
" - 1s - loss: 2.7956 - val_loss: 3.3540\n", | |
"Epoch 80/1000\n", | |
" - 1s - loss: 2.8168 - val_loss: 3.0450\n", | |
"Epoch 81/1000\n", | |
" - 1s - loss: 2.8285 - val_loss: 2.7926\n", | |
"Epoch 82/1000\n", | |
" - 1s - loss: 2.7765 - val_loss: 2.8455\n", | |
"Epoch 83/1000\n", | |
" - 1s - loss: 2.7778 - val_loss: 3.3278\n", | |
"Epoch 84/1000\n", | |
" - 1s - loss: 2.8557 - val_loss: 2.7703\n", | |
"Epoch 85/1000\n", | |
" - 1s - loss: 2.7913 - val_loss: 2.8085\n", | |
"Epoch 86/1000\n", | |
" - 1s - loss: 2.7491 - val_loss: 3.0603\n", | |
"Epoch 87/1000\n", | |
" - 1s - loss: 2.7871 - val_loss: 2.8578\n", | |
"Epoch 88/1000\n", | |
" - 1s - loss: 2.8144 - val_loss: 3.1336\n", | |
"Epoch 89/1000\n", | |
" - 1s - loss: 2.7388 - val_loss: 2.9888\n", | |
"Epoch 90/1000\n", | |
" - 1s - loss: 2.7873 - val_loss: 2.7516\n", | |
"Epoch 91/1000\n", | |
" - 1s - loss: 2.7479 - val_loss: 2.8912\n", | |
"Epoch 92/1000\n", | |
" - 1s - loss: 2.7327 - val_loss: 2.7610\n", | |
"Epoch 93/1000\n", | |
" - 1s - loss: 2.7468 - val_loss: 2.9736\n", | |
"Epoch 94/1000\n", | |
" - 1s - loss: 2.7259 - val_loss: 2.9166\n", | |
"Epoch 95/1000\n", | |
" - 1s - loss: 2.7652 - val_loss: 2.6974\n", | |
"Epoch 96/1000\n", | |
" - 1s - loss: 2.7649 - val_loss: 2.7026\n", | |
"Epoch 97/1000\n", | |
" - 1s - loss: 2.7535 - val_loss: 2.7129\n", | |
"Epoch 98/1000\n", | |
" - 1s - loss: 2.7827 - val_loss: 3.0586\n", | |
"Epoch 99/1000\n", | |
" - 1s - loss: 2.7670 - val_loss: 2.7034\n", | |
"Epoch 100/1000\n", | |
" - 1s - loss: 2.6683 - val_loss: 2.8728\n", | |
"Epoch 101/1000\n", | |
" - 1s - loss: 2.7351 - val_loss: 2.6637\n", | |
"Epoch 102/1000\n", | |
" - 1s - loss: 2.7217 - val_loss: 2.8742\n", | |
"Epoch 103/1000\n", | |
" - 1s - loss: 2.6876 - val_loss: 2.7453\n", | |
"Epoch 104/1000\n", | |
" - 1s - loss: 2.6671 - val_loss: 3.0600\n", | |
"Epoch 105/1000\n", | |
" - 1s - loss: 2.7866 - val_loss: 2.7262\n", | |
"Epoch 106/1000\n", | |
" - 1s - loss: 2.7277 - val_loss: 2.6761\n", | |
"Epoch 107/1000\n", | |
" - 1s - loss: 2.7005 - val_loss: 2.6564\n", | |
"Epoch 108/1000\n", | |
" - 1s - loss: 2.6608 - val_loss: 2.6327\n", | |
"Epoch 109/1000\n", | |
" - 1s - loss: 2.7170 - val_loss: 2.6369\n", | |
"Epoch 110/1000\n", | |
" - 1s - loss: 2.7061 - val_loss: 2.6897\n", | |
"Epoch 111/1000\n", | |
" - 1s - loss: 2.6653 - val_loss: 2.8486\n", | |
"Epoch 112/1000\n", | |
" - 1s - loss: 2.7441 - val_loss: 3.4665\n", | |
"Epoch 113/1000\n", | |
" - 1s - loss: 2.7091 - val_loss: 2.6547\n", | |
"Epoch 114/1000\n", | |
" - 1s - loss: 2.6954 - val_loss: 2.9514\n", | |
"Epoch 115/1000\n", | |
" - 1s - loss: 2.6503 - val_loss: 2.6581\n", | |
"Epoch 116/1000\n", | |
" - 1s - loss: 2.7008 - val_loss: 2.6493\n", | |
"Epoch 117/1000\n", | |
" - 1s - loss: 2.6861 - val_loss: 2.6724\n", | |
"Epoch 118/1000\n", | |
" - 1s - loss: 2.6537 - val_loss: 2.6604\n", | |
"\n", | |
"Epoch 00118: ReduceLROnPlateau reducing learning rate to 0.000999999977648.\n", | |
"Epoch 119/1000\n", | |
" - 1s - loss: 2.5312 - val_loss: 2.6275\n", | |
"Epoch 120/1000\n", | |
" - 1s - loss: 2.5087 - val_loss: 2.5996\n", | |
"Epoch 121/1000\n", | |
" - 1s - loss: 2.5169 - val_loss: 2.6602\n", | |
"Epoch 122/1000\n", | |
" - 1s - loss: 2.5106 - val_loss: 2.6682\n", | |
"Epoch 123/1000\n", | |
" - 1s - loss: 2.5047 - val_loss: 2.6286\n", | |
"Epoch 124/1000\n", | |
" - 1s - loss: 2.4938 - val_loss: 2.6131\n", | |
"Epoch 125/1000\n", | |
" - 1s - loss: 2.5097 - val_loss: 2.6047\n", | |
"Epoch 126/1000\n", | |
" - 1s - loss: 2.5078 - val_loss: 2.6085\n", | |
"Epoch 127/1000\n", | |
" - 1s - loss: 2.5053 - val_loss: 2.7178\n", | |
"Epoch 128/1000\n", | |
" - 1s - loss: 2.5112 - val_loss: 2.6119\n", | |
"Epoch 129/1000\n", | |
" - 1s - loss: 2.4913 - val_loss: 2.7506\n", | |
"Epoch 130/1000\n", | |
" - 1s - loss: 2.4953 - val_loss: 2.6360\n", | |
"\n", | |
"Epoch 00130: ReduceLROnPlateau reducing learning rate to 9.99999931082e-05.\n", | |
"Epoch 131/1000\n", | |
" - 1s - loss: 2.4813 - val_loss: 2.6267\n", | |
"Epoch 132/1000\n", | |
" - 1s - loss: 2.4783 - val_loss: 2.6135\n", | |
"Epoch 133/1000\n", | |
" - 1s - loss: 2.4802 - val_loss: 2.6129\n", | |
"Epoch 134/1000\n", | |
" - 1s - loss: 2.4777 - val_loss: 2.6114\n", | |
"Epoch 135/1000\n", | |
" - 1s - loss: 2.4789 - val_loss: 2.6123\n", | |
"Epoch 136/1000\n", | |
" - 1s - loss: 2.4783 - val_loss: 2.6130\n", | |
"Epoch 137/1000\n", | |
" - 1s - loss: 2.4784 - val_loss: 2.6126\n", | |
"Epoch 138/1000\n", | |
" - 1s - loss: 2.4786 - val_loss: 2.6153\n", | |
"Epoch 139/1000\n", | |
" - 1s - loss: 2.4773 - val_loss: 2.6144\n", | |
"Epoch 140/1000\n", | |
" - 1s - loss: 2.4782 - val_loss: 2.6142\n", | |
"\n", | |
"Epoch 00140: ReduceLROnPlateau reducing learning rate to 9.99999901978e-06.\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"<keras.callbacks.History at 0x13494cfd0>" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"model.fit(alphas, xts, batch_size=1, epochs=1000, validation_split=0.5, verbose=2, \n", | |
" callbacks=[keras.callbacks.EarlyStopping(patience=20),\n", | |
" keras.callbacks.ReduceLROnPlateau(patience=10, verbose=1)])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Text(0.5,1,'Error plot')" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEICAYAAABcVE8dAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAGDhJREFUeJzt3WuQHNdZxvHn0c2WrBQWlrC9m8RygpNit4qYsGWSogiGFRBSECdAwKlVYucmeQeD4VsScTEXA0UBqRCwZAGu2NGUHUhw4tyJDBUXFLmsgxMkG4NjLCLJiTd2TJCvurx8mBl7vJ7p7t2Z7p7p/v+qprTT56j7tGb17NnTp087IgQAqL5VZTcAAFAMAh8AaoLAB4CaIPABoCYIfACoCQIfAGqCwAdyZPv9tn+/7HYAEoGPMWb7ftuP2z7W9fqLstu1UrbD9veW3Q5U15qyGwAM6GcjYn9aJdtrIuJE2rbl7gMYJ/TwUUm2L7f9L7bfY/shSVf32bbK9m/YPmT7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q/ZkT8fY8qlfqc0863qp9zFgT+M74k6QLb59teJ+lSSbd2V1gyrvlatcYHq+xWSW9uz+J4haT/jYgHym5UXmyfY9vtry9S6//HQ+W2ajDt8/kbSXdHxJ/1qVaZzznL+Vbxc86qGg8xH4KIOGH7SkmfUWvGzvURcdD270paiIhbJf2q7ddKOqHWxb/LS2vwENi+Sa0ZC5ttH5b025LWSlJE7JH0SbVmcNwr6TFJbymnpcOR4Xx/QdK87ROSHpd0abSndYyxH5b0Jkn/bvvO9rZ3S3qhVMnPOcv5VvFzzoSlFQCgJhjSAYCaIPABoCYIfACoCQIfAGqCwAeAmiDwAaAmCHwAqIn/B37rugin+1TkAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"plt.plot(alphas, xts - np.reshape(model.predict(alphas), [N]), 'ro')\n", | |
"plt.title('Error plot')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Add more parameters" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import keras\n", | |
"from keras.models import Sequential\n", | |
"from keras.layers import Dense, Activation" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"model = Sequential([\n", | |
" Dense(100, input_shape=(1,), activation='sigmoid'),\n", | |
" Dense(100, activation='sigmoid'),\n", | |
" Dense(100, activation='sigmoid'),\n", | |
" Dense(1, activation='linear')\n", | |
"])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"model.compile(keras.optimizers.adam(0.01), 'mae')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": { | |
"scrolled": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Train on 500 samples, validate on 500 samples\n", | |
"Epoch 1/1000\n", | |
" - 1s - loss: 8.7532 - val_loss: 9.4619\n", | |
"Epoch 2/1000\n", | |
" - 1s - loss: 8.6549 - val_loss: 8.7629\n", | |
"Epoch 3/1000\n", | |
" - 1s - loss: 4.1797 - val_loss: 2.8980\n", | |
"Epoch 4/1000\n", | |
" - 1s - loss: 2.7264 - val_loss: 2.1787\n", | |
"Epoch 5/1000\n", | |
" - 1s - loss: 2.1460 - val_loss: 3.4483\n", | |
"Epoch 6/1000\n", | |
" - 1s - loss: 2.3181 - val_loss: 2.1554\n", | |
"Epoch 7/1000\n", | |
" - 1s - loss: 1.9001 - val_loss: 2.2891\n", | |
"Epoch 8/1000\n", | |
" - 1s - loss: 1.7631 - val_loss: 1.6546\n", | |
"Epoch 9/1000\n", | |
" - 1s - loss: 1.8787 - val_loss: 3.0211\n", | |
"Epoch 10/1000\n", | |
" - 1s - loss: 1.3719 - val_loss: 1.0239\n", | |
"Epoch 11/1000\n", | |
" - 1s - loss: 1.5782 - val_loss: 1.3933\n", | |
"Epoch 12/1000\n", | |
" - 1s - loss: 1.2955 - val_loss: 2.0476\n", | |
"Epoch 13/1000\n", | |
" - 1s - loss: 1.4562 - val_loss: 1.3873\n", | |
"Epoch 14/1000\n", | |
" - 1s - loss: 1.5530 - val_loss: 1.8240\n", | |
"Epoch 15/1000\n", | |
" - 1s - loss: 1.4931 - val_loss: 0.7797\n", | |
"Epoch 16/1000\n", | |
" - 1s - loss: 1.2939 - val_loss: 0.7529\n", | |
"Epoch 17/1000\n", | |
" - 1s - loss: 1.4188 - val_loss: 1.1303\n", | |
"Epoch 18/1000\n", | |
" - 1s - loss: 1.3619 - val_loss: 1.0933\n", | |
"Epoch 19/1000\n", | |
" - 1s - loss: 1.1092 - val_loss: 0.9383\n", | |
"Epoch 20/1000\n", | |
" - 1s - loss: 1.2492 - val_loss: 1.1624\n", | |
"Epoch 21/1000\n", | |
" - 1s - loss: 1.3205 - val_loss: 1.0803\n", | |
"Epoch 22/1000\n", | |
" - 1s - loss: 1.2218 - val_loss: 0.9855\n", | |
"Epoch 23/1000\n", | |
" - 1s - loss: 1.3948 - val_loss: 1.1764\n", | |
"Epoch 24/1000\n", | |
" - 1s - loss: 1.5514 - val_loss: 1.3135\n", | |
"Epoch 25/1000\n", | |
" - 1s - loss: 1.1839 - val_loss: 1.4799\n", | |
"Epoch 26/1000\n", | |
" - 1s - loss: 1.4382 - val_loss: 1.4105\n", | |
"\n", | |
"Epoch 00026: ReduceLROnPlateau reducing learning rate to 0.000999999977648.\n", | |
"Epoch 27/1000\n", | |
" - 1s - loss: 0.7521 - val_loss: 0.5351\n", | |
"Epoch 28/1000\n", | |
" - 1s - loss: 0.4792 - val_loss: 0.4284\n", | |
"Epoch 29/1000\n", | |
" - 1s - loss: 0.3499 - val_loss: 0.2595\n", | |
"Epoch 30/1000\n", | |
" - 1s - loss: 0.2936 - val_loss: 0.2495\n", | |
"Epoch 31/1000\n", | |
" - 1s - loss: 0.2522 - val_loss: 0.2264\n", | |
"Epoch 32/1000\n", | |
" - 1s - loss: 0.2223 - val_loss: 0.2031\n", | |
"Epoch 33/1000\n", | |
" - 1s - loss: 0.2229 - val_loss: 0.2000\n", | |
"Epoch 34/1000\n", | |
" - 1s - loss: 0.2102 - val_loss: 0.2356\n", | |
"Epoch 35/1000\n", | |
" - 1s - loss: 0.1958 - val_loss: 0.2326\n", | |
"Epoch 36/1000\n", | |
" - 1s - loss: 0.1814 - val_loss: 0.2276\n", | |
"Epoch 37/1000\n", | |
" - 1s - loss: 0.1806 - val_loss: 0.2065\n", | |
"Epoch 38/1000\n", | |
" - 1s - loss: 0.1727 - val_loss: 0.2939\n", | |
"Epoch 39/1000\n", | |
" - 1s - loss: 0.1776 - val_loss: 0.1515\n", | |
"Epoch 40/1000\n", | |
" - 1s - loss: 0.1472 - val_loss: 0.1844\n", | |
"Epoch 41/1000\n", | |
" - 1s - loss: 0.1610 - val_loss: 0.2021\n", | |
"Epoch 42/1000\n", | |
" - 1s - loss: 0.1654 - val_loss: 0.1308\n", | |
"Epoch 43/1000\n", | |
" - 1s - loss: 0.1446 - val_loss: 0.1592\n", | |
"Epoch 44/1000\n", | |
" - 1s - loss: 0.1528 - val_loss: 0.1225\n", | |
"Epoch 45/1000\n", | |
" - 1s - loss: 0.1622 - val_loss: 0.1595\n", | |
"Epoch 46/1000\n", | |
" - 1s - loss: 0.1604 - val_loss: 0.1989\n", | |
"Epoch 47/1000\n", | |
" - 1s - loss: 0.1554 - val_loss: 0.1921\n", | |
"Epoch 48/1000\n", | |
" - 1s - loss: 0.1522 - val_loss: 0.1574\n", | |
"Epoch 49/1000\n", | |
" - 1s - loss: 0.1395 - val_loss: 0.1172\n", | |
"Epoch 50/1000\n", | |
" - 1s - loss: 0.1435 - val_loss: 0.1494\n", | |
"Epoch 51/1000\n", | |
" - 1s - loss: 0.1723 - val_loss: 0.2866\n", | |
"Epoch 52/1000\n", | |
" - 1s - loss: 0.1514 - val_loss: 0.2148\n", | |
"Epoch 53/1000\n", | |
" - 1s - loss: 0.1512 - val_loss: 0.1533\n", | |
"Epoch 54/1000\n", | |
" - 1s - loss: 0.1270 - val_loss: 0.1388\n", | |
"Epoch 55/1000\n", | |
" - 1s - loss: 0.1437 - val_loss: 0.1978\n", | |
"Epoch 56/1000\n", | |
" - 1s - loss: 0.1382 - val_loss: 0.1986\n", | |
"Epoch 57/1000\n", | |
" - 1s - loss: 0.1446 - val_loss: 0.2621\n", | |
"Epoch 58/1000\n", | |
" - 1s - loss: 0.1575 - val_loss: 0.1106\n", | |
"Epoch 59/1000\n", | |
" - 1s - loss: 0.1549 - val_loss: 0.1673\n", | |
"Epoch 60/1000\n", | |
" - 1s - loss: 0.1527 - val_loss: 0.1388\n", | |
"Epoch 61/1000\n", | |
" - 1s - loss: 0.1556 - val_loss: 0.1491\n", | |
"Epoch 62/1000\n", | |
" - 1s - loss: 0.1472 - val_loss: 0.1261\n", | |
"Epoch 63/1000\n", | |
" - 1s - loss: 0.1449 - val_loss: 0.2812\n", | |
"Epoch 64/1000\n", | |
" - 1s - loss: 0.1633 - val_loss: 0.1292\n", | |
"Epoch 65/1000\n", | |
" - 1s - loss: 0.1346 - val_loss: 0.2302\n", | |
"Epoch 66/1000\n", | |
" - 1s - loss: 0.1540 - val_loss: 0.1819\n", | |
"Epoch 67/1000\n", | |
" - 1s - loss: 0.1513 - val_loss: 0.1354\n", | |
"Epoch 68/1000\n", | |
" - 1s - loss: 0.1391 - val_loss: 0.2778\n", | |
"\n", | |
"Epoch 00068: ReduceLROnPlateau reducing learning rate to 9.99999931082e-05.\n", | |
"Epoch 69/1000\n", | |
" - 1s - loss: 0.0841 - val_loss: 0.0599\n", | |
"Epoch 70/1000\n", | |
" - 1s - loss: 0.0458 - val_loss: 0.0508\n", | |
"Epoch 71/1000\n", | |
" - 1s - loss: 0.0436 - val_loss: 0.0519\n", | |
"Epoch 72/1000\n", | |
" - 1s - loss: 0.0424 - val_loss: 0.0517\n", | |
"Epoch 73/1000\n", | |
" - 1s - loss: 0.0408 - val_loss: 0.0508\n", | |
"Epoch 74/1000\n", | |
" - 1s - loss: 0.0399 - val_loss: 0.0513\n", | |
"Epoch 75/1000\n", | |
" - 1s - loss: 0.0407 - val_loss: 0.0504\n", | |
"Epoch 76/1000\n", | |
" - 1s - loss: 0.0423 - val_loss: 0.0470\n", | |
"Epoch 77/1000\n", | |
" - 1s - loss: 0.0400 - val_loss: 0.0464\n", | |
"Epoch 78/1000\n", | |
" - 1s - loss: 0.0399 - val_loss: 0.0475\n", | |
"Epoch 79/1000\n", | |
" - 1s - loss: 0.0398 - val_loss: 0.0453\n", | |
"Epoch 80/1000\n", | |
" - 1s - loss: 0.0383 - val_loss: 0.0441\n", | |
"Epoch 81/1000\n", | |
" - 1s - loss: 0.0392 - val_loss: 0.0441\n", | |
"Epoch 82/1000\n", | |
" - 1s - loss: 0.0382 - val_loss: 0.0508\n", | |
"Epoch 83/1000\n", | |
" - 1s - loss: 0.0393 - val_loss: 0.0456\n", | |
"Epoch 84/1000\n", | |
" - 1s - loss: 0.0386 - val_loss: 0.0497\n", | |
"Epoch 85/1000\n", | |
" - 1s - loss: 0.0394 - val_loss: 0.0443\n", | |
"Epoch 86/1000\n", | |
" - 1s - loss: 0.0354 - val_loss: 0.0544\n", | |
"Epoch 87/1000\n", | |
" - 1s - loss: 0.0364 - val_loss: 0.0451\n", | |
"Epoch 88/1000\n", | |
" - 1s - loss: 0.0372 - val_loss: 0.0424\n", | |
"Epoch 89/1000\n", | |
" - 1s - loss: 0.0364 - val_loss: 0.0407\n", | |
"Epoch 90/1000\n", | |
" - 1s - loss: 0.0359 - val_loss: 0.0406\n", | |
"Epoch 91/1000\n", | |
" - 1s - loss: 0.0359 - val_loss: 0.0470\n", | |
"Epoch 92/1000\n", | |
" - 1s - loss: 0.0357 - val_loss: 0.0473\n", | |
"Epoch 93/1000\n", | |
" - 1s - loss: 0.0354 - val_loss: 0.0443\n", | |
"Epoch 94/1000\n", | |
" - 1s - loss: 0.0350 - val_loss: 0.0403\n", | |
"Epoch 95/1000\n", | |
" - 1s - loss: 0.0351 - val_loss: 0.0510\n", | |
"Epoch 96/1000\n", | |
" - 1s - loss: 0.0327 - val_loss: 0.0387\n", | |
"Epoch 97/1000\n", | |
" - 1s - loss: 0.0356 - val_loss: 0.0545\n", | |
"Epoch 98/1000\n", | |
" - 1s - loss: 0.0341 - val_loss: 0.0409\n", | |
"Epoch 99/1000\n", | |
" - 1s - loss: 0.0365 - val_loss: 0.0409\n", | |
"Epoch 100/1000\n", | |
" - 1s - loss: 0.0365 - val_loss: 0.0376\n", | |
"Epoch 101/1000\n", | |
" - 1s - loss: 0.0325 - val_loss: 0.0536\n", | |
"Epoch 102/1000\n", | |
" - 1s - loss: 0.0346 - val_loss: 0.0391\n", | |
"Epoch 103/1000\n", | |
" - 1s - loss: 0.0347 - val_loss: 0.0374\n", | |
"Epoch 104/1000\n", | |
" - 1s - loss: 0.0323 - val_loss: 0.0453\n", | |
"Epoch 105/1000\n", | |
" - 1s - loss: 0.0347 - val_loss: 0.0407\n", | |
"Epoch 106/1000\n", | |
" - 1s - loss: 0.0318 - val_loss: 0.0393\n", | |
"Epoch 107/1000\n", | |
" - 1s - loss: 0.0333 - val_loss: 0.0502\n", | |
"Epoch 108/1000\n", | |
" - 1s - loss: 0.0314 - val_loss: 0.0488\n", | |
"Epoch 109/1000\n", | |
" - 1s - loss: 0.0316 - val_loss: 0.0382\n", | |
"Epoch 110/1000\n", | |
" - 1s - loss: 0.0333 - val_loss: 0.0390\n", | |
"Epoch 111/1000\n", | |
" - 1s - loss: 0.0327 - val_loss: 0.0519\n", | |
"Epoch 112/1000\n", | |
" - 1s - loss: 0.0324 - val_loss: 0.0449\n", | |
"Epoch 113/1000\n", | |
" - 1s - loss: 0.0336 - val_loss: 0.0388\n", | |
"\n", | |
"Epoch 00113: ReduceLROnPlateau reducing learning rate to 9.99999901978e-06.\n", | |
"Epoch 114/1000\n", | |
" - 1s - loss: 0.0267 - val_loss: 0.0350\n", | |
"Epoch 115/1000\n", | |
" - 1s - loss: 0.0253 - val_loss: 0.0351\n", | |
"Epoch 116/1000\n", | |
" - 1s - loss: 0.0251 - val_loss: 0.0355\n", | |
"Epoch 117/1000\n", | |
" - 1s - loss: 0.0250 - val_loss: 0.0348\n", | |
"Epoch 118/1000\n", | |
" - 1s - loss: 0.0254 - val_loss: 0.0356\n", | |
"Epoch 119/1000\n", | |
" - 1s - loss: 0.0252 - val_loss: 0.0347\n", | |
"Epoch 120/1000\n", | |
" - 1s - loss: 0.0250 - val_loss: 0.0342\n", | |
"Epoch 121/1000\n", | |
" - 1s - loss: 0.0252 - val_loss: 0.0354\n", | |
"Epoch 122/1000\n", | |
" - 1s - loss: 0.0250 - val_loss: 0.0342\n", | |
"Epoch 123/1000\n", | |
" - 1s - loss: 0.0247 - val_loss: 0.0341\n", | |
"Epoch 124/1000\n", | |
" - 1s - loss: 0.0250 - val_loss: 0.0353\n", | |
"Epoch 125/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0340\n", | |
"Epoch 126/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0345\n", | |
"Epoch 127/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0352\n", | |
"Epoch 128/1000\n", | |
" - 1s - loss: 0.0251 - val_loss: 0.0346\n", | |
"Epoch 129/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0343\n", | |
"Epoch 130/1000\n", | |
" - 1s - loss: 0.0250 - val_loss: 0.0339\n", | |
"Epoch 131/1000\n", | |
" - 1s - loss: 0.0250 - val_loss: 0.0357\n", | |
"Epoch 132/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0344\n", | |
"Epoch 133/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0342\n", | |
"Epoch 134/1000\n", | |
" - 1s - loss: 0.0249 - val_loss: 0.0343\n", | |
"Epoch 135/1000\n", | |
" - 1s - loss: 0.0248 - val_loss: 0.0340\n", | |
"Epoch 136/1000\n", | |
" - 1s - loss: 0.0248 - val_loss: 0.0336\n", | |
"Epoch 137/1000\n", | |
" - 1s - loss: 0.0245 - val_loss: 0.0344\n", | |
"Epoch 138/1000\n", | |
" - 1s - loss: 0.0246 - val_loss: 0.0339\n", | |
"Epoch 139/1000\n", | |
" - 1s - loss: 0.0247 - val_loss: 0.0339\n", | |
"Epoch 140/1000\n", | |
" - 1s - loss: 0.0247 - val_loss: 0.0338\n", | |
"Epoch 141/1000\n", | |
" - 1s - loss: 0.0247 - val_loss: 0.0343\n", | |
"Epoch 142/1000\n", | |
" - 1s - loss: 0.0248 - val_loss: 0.0358\n", | |
"Epoch 143/1000\n", | |
" - 1s - loss: 0.0247 - val_loss: 0.0343\n", | |
"Epoch 144/1000\n", | |
" - 1s - loss: 0.0246 - val_loss: 0.0351\n", | |
"Epoch 145/1000\n", | |
" - 1s - loss: 0.0247 - val_loss: 0.0338\n", | |
"Epoch 146/1000\n", | |
" - 1s - loss: 0.0246 - val_loss: 0.0340\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\n", | |
"Epoch 00146: ReduceLROnPlateau reducing learning rate to 9.99999883788e-07.\n", | |
"Epoch 147/1000\n", | |
" - 1s - loss: 0.0241 - val_loss: 0.0337\n", | |
"Epoch 148/1000\n", | |
" - 1s - loss: 0.0238 - val_loss: 0.0337\n", | |
"Epoch 149/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0337\n", | |
"Epoch 150/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0338\n", | |
"Epoch 151/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0337\n", | |
"Epoch 152/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0338\n", | |
"Epoch 153/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0339\n", | |
"Epoch 154/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0337\n", | |
"Epoch 155/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0339\n", | |
"Epoch 156/1000\n", | |
" - 1s - loss: 0.0237 - val_loss: 0.0338\n", | |
"\n", | |
"Epoch 00156: ReduceLROnPlateau reducing learning rate to 9.99999883788e-08.\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"<keras.callbacks.History at 0x134f80dd0>" | |
] | |
}, | |
"execution_count": 14, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"model.fit(alphas, xts, batch_size=1, epochs=1000, validation_split=0.5, verbose=2, \n", | |
" callbacks=[keras.callbacks.EarlyStopping(patience=20),\n", | |
" keras.callbacks.ReduceLROnPlateau(patience=10, verbose=1)])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Text(0.5,1,'Error plot')" | |
] | |
}, | |
"execution_count": 15, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEICAYAAAC3Y/QeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAHUdJREFUeJzt3X+QJOV93/H3d/dugQXJwN7VcQfaXSkmKR2JLIkNEXHpR3yrMqZswIljY4/EIUte2IsTJSn/gbxxoii5hLIqjmXLIDaAc9JOWViyJVCMCnMXVUilLEWLDBI/IvEj7Ak4YAFhBa3EmeObP7rnbnauf3fPzG7351XVNdPdzzzP0/Pj2z1PP/20uTsiItIsI8OugIiIDJ6Cv4hIAyn4i4g0kIK/iEgDKfiLiDSQgr+ISAMp+IsMkJn9VzP798Ouh4iCv9SGmT1hZj80s5e7pk8Ou15FmZmb2Y8Pux5ST1uGXQGRiv2cux9MS2RmW9z91bRlefMQ2Sx05C+NYGZXm9n/MrP/bGYvAB+NWTZiZv/KzFbM7Dkz+7SZ/ViYx3R4NP5BMzsM/PeIct5jZk+a2W+a2fPhv5FWQr1+zcweNbMXzewOM9sVLr8nTHJ/+A/ml6p/V6TJFPylSf4e8DiwA9gfs+zqcPoHwJuAM4DepqN3A28GfjqmnHOAbcC5wF5g0cz+Vm8iM/sp4D8CvwjsBFaAzwK4+7vCZD/h7me4+225tlQkhYK/1M0XzeylrunXutY97e6/7+6vuvsPY5a1gN9x98fd/WXgI8CVZtbdRPpRd/9BVx5RfsvdX3H3/wH8GUGA79UCbnX3b7j7K2FZF5vZdLFNF8lObf5SN1cktPl/N8OyXQRH4B0rBL+THSn5dPueu/+gJ49dEel2Ad/ozLj7y2Hz07nAEylliJSiI39pkqghbHuXPQ1Mdc1PAq8Cz6bk0+0s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0Vlr5GIzu9/MvmxmFwy7MlUys2ngbcDXelbV8nNO2F6o8eecRMG/uC8B0+7+FuBu4MCQ6yPV+gYw5e4/QTCEyReHXJ/KmNkZwJ8A/9zdvz/s+vRbyvbW9nNOo+AfLXUkUnd/wd1fCWdvBi4cUN2GpVGjs7r799395fD5ncBWM9s25GqVZmZbCQJh293/NCJJrT7ntO2t6+echYJ/tOMjkZrZGMFIpHd0J+hpB72MoD2xzu4Argp7g7wD+Ct3PzLsSvWLmZ1j4S3qzOwigt/KC8OtVTnh9twCPOzuvxOTrDafc5btrePnnNUghnTedNz9VTP7deAuToxE+qCZfQxYdvc7gH9mZpcBrxKcOLx6aBWugJn9EUHPh21m9iTwb4CtAO7+KYKB+S4FHgXWgA8Mp6bVyLC9vwDMm9mrwA+BKz3sHrKJ/STwfuBbZnZfuOw3gUmo5eecZXvr+DlnouEdREQaSM0+IiINpOAvItJACv4iIg2k4C8i0kAK/iIiDaTgLyLSQAr+IiIN9P8BuVSv3g/hM+4AAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"plt.plot(alphas, xts - np.reshape(model.predict(alphas), [N]), 'ro')\n", | |
"plt.title('Error plot')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Better model" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import keras\n", | |
"from keras.models import Sequential\n", | |
"from keras.layers import Dense, Activation\n", | |
"import tensorflow as tf\n", | |
"import keras.backend as K" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def clamped_tan(x):\n", | |
" return tf.clip_by_value(tf.tan(x), -100, 100)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"model = Sequential([\n", | |
" Dense(1, input_shape=(1,), activation=clamped_tan),\n", | |
" Dense(1, activation='linear'),\n", | |
"])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# note, we need higher LR to escape local minimas\n", | |
"model.compile(keras.optimizers.adam(0.1), 'mae')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 20, | |
"metadata": { | |
"scrolled": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Train on 500 samples, validate on 500 samples\n", | |
"Epoch 1/1000\n", | |
" - 1s - loss: 9.3882 - val_loss: 9.2950\n", | |
"Epoch 2/1000\n", | |
" - 1s - loss: 8.4865 - val_loss: 8.1812\n", | |
"Epoch 3/1000\n", | |
" - 1s - loss: 8.8095 - val_loss: 10.6867\n", | |
"Epoch 4/1000\n", | |
" - 1s - loss: 8.0937 - val_loss: 7.9604\n", | |
"Epoch 5/1000\n", | |
" - 1s - loss: 5.8308 - val_loss: 3.8140\n", | |
"Epoch 6/1000\n", | |
" - 1s - loss: 2.2599 - val_loss: 3.2915\n", | |
"Epoch 7/1000\n", | |
" - 1s - loss: 1.9299 - val_loss: 1.3904\n", | |
"Epoch 8/1000\n", | |
" - 1s - loss: 3.6888 - val_loss: 3.7436\n", | |
"Epoch 9/1000\n", | |
" - 0s - loss: 10.4053 - val_loss: 6.9549\n", | |
"Epoch 10/1000\n", | |
" - 1s - loss: 9.4471 - val_loss: 9.7340\n", | |
"Epoch 11/1000\n", | |
" - 1s - loss: 7.1927 - val_loss: 5.2702\n", | |
"Epoch 12/1000\n", | |
" - 1s - loss: 2.2219 - val_loss: 1.7317\n", | |
"Epoch 13/1000\n", | |
" - 1s - loss: 0.6109 - val_loss: 0.1838\n", | |
"Epoch 14/1000\n", | |
" - 1s - loss: 0.5237 - val_loss: 0.7525\n", | |
"Epoch 15/1000\n", | |
" - 1s - loss: 0.7018 - val_loss: 0.6387\n", | |
"Epoch 16/1000\n", | |
" - 1s - loss: 0.6286 - val_loss: 0.3456\n", | |
"Epoch 17/1000\n", | |
" - 0s - loss: 1.0029 - val_loss: 0.6240\n", | |
"Epoch 18/1000\n", | |
" - 0s - loss: 1.0459 - val_loss: 1.0381\n", | |
"Epoch 19/1000\n", | |
" - 0s - loss: 1.1080 - val_loss: 1.3432\n", | |
"Epoch 20/1000\n", | |
" - 0s - loss: 1.7839 - val_loss: 0.8179\n", | |
"Epoch 21/1000\n", | |
" - 0s - loss: 4.5418 - val_loss: 1.0650\n", | |
"Epoch 22/1000\n", | |
" - 0s - loss: 7.9761 - val_loss: 5.5950\n", | |
"Epoch 23/1000\n", | |
" - 1s - loss: 1.9594 - val_loss: 1.6370\n", | |
"\n", | |
"Epoch 00023: ReduceLROnPlateau reducing learning rate to 0.010000000149.\n", | |
"Epoch 24/1000\n", | |
" - 1s - loss: 0.2774 - val_loss: 0.1575\n", | |
"Epoch 25/1000\n", | |
" - 1s - loss: 0.1945 - val_loss: 0.1247\n", | |
"Epoch 26/1000\n", | |
" - 1s - loss: 0.1626 - val_loss: 0.1484\n", | |
"Epoch 27/1000\n", | |
" - 1s - loss: 0.2114 - val_loss: 0.0803\n", | |
"Epoch 28/1000\n", | |
" - 1s - loss: 0.2154 - val_loss: 0.0957\n", | |
"Epoch 29/1000\n", | |
" - 0s - loss: 0.2935 - val_loss: 0.3342\n", | |
"Epoch 30/1000\n", | |
" - 0s - loss: 0.2423 - val_loss: 0.7723\n", | |
"Epoch 31/1000\n", | |
" - 1s - loss: 0.2901 - val_loss: 0.0723\n", | |
"Epoch 32/1000\n", | |
" - 0s - loss: 0.2627 - val_loss: 0.1582\n", | |
"Epoch 33/1000\n", | |
" - 0s - loss: 0.3267 - val_loss: 0.6098\n", | |
"Epoch 34/1000\n", | |
" - 0s - loss: 0.3307 - val_loss: 0.2420\n", | |
"Epoch 35/1000\n", | |
" - 1s - loss: 0.2961 - val_loss: 0.3767\n", | |
"Epoch 36/1000\n", | |
" - 1s - loss: 0.3996 - val_loss: 1.2126\n", | |
"Epoch 37/1000\n", | |
" - 1s - loss: 0.3267 - val_loss: 0.0422\n", | |
"Epoch 38/1000\n", | |
" - 1s - loss: 0.3453 - val_loss: 0.9478\n", | |
"Epoch 39/1000\n", | |
" - 1s - loss: 0.3346 - val_loss: 0.0480\n", | |
"Epoch 40/1000\n", | |
" - 1s - loss: 0.2920 - val_loss: 0.1970\n", | |
"Epoch 41/1000\n", | |
" - 1s - loss: 0.3187 - val_loss: 0.6392\n", | |
"Epoch 42/1000\n", | |
" - 1s - loss: 0.2981 - val_loss: 0.3982\n", | |
"Epoch 43/1000\n", | |
" - 1s - loss: 0.2875 - val_loss: 0.2427\n", | |
"Epoch 44/1000\n", | |
" - 1s - loss: 0.3193 - val_loss: 0.3648\n", | |
"Epoch 45/1000\n", | |
" - 1s - loss: 0.2251 - val_loss: 0.1762\n", | |
"Epoch 46/1000\n", | |
" - 1s - loss: 0.3825 - val_loss: 0.7760\n", | |
"Epoch 47/1000\n", | |
" - 0s - loss: 0.4387 - val_loss: 0.3939\n", | |
"\n", | |
"Epoch 00047: ReduceLROnPlateau reducing learning rate to 0.000999999977648.\n", | |
"Epoch 48/1000\n", | |
" - 1s - loss: 0.0645 - val_loss: 0.0457\n", | |
"Epoch 49/1000\n", | |
" - 0s - loss: 0.0279 - val_loss: 0.0489\n", | |
"Epoch 50/1000\n", | |
" - 1s - loss: 0.0320 - val_loss: 0.0128\n", | |
"Epoch 51/1000\n", | |
" - 0s - loss: 0.0248 - val_loss: 0.0150\n", | |
"Epoch 52/1000\n", | |
" - 1s - loss: 0.0343 - val_loss: 0.0166\n", | |
"Epoch 53/1000\n", | |
" - 1s - loss: 0.0298 - val_loss: 0.0142\n", | |
"Epoch 54/1000\n", | |
" - 1s - loss: 0.0334 - val_loss: 0.0489\n", | |
"Epoch 55/1000\n", | |
" - 1s - loss: 0.0364 - val_loss: 0.0499\n", | |
"Epoch 56/1000\n", | |
" - 1s - loss: 0.0316 - val_loss: 0.0138\n", | |
"Epoch 57/1000\n", | |
" - 0s - loss: 0.0377 - val_loss: 0.0401\n", | |
"Epoch 58/1000\n", | |
" - 1s - loss: 0.0324 - val_loss: 0.0121\n", | |
"Epoch 59/1000\n", | |
" - 1s - loss: 0.0270 - val_loss: 0.0115\n", | |
"Epoch 60/1000\n", | |
" - 0s - loss: 0.0269 - val_loss: 0.0458\n", | |
"Epoch 61/1000\n", | |
" - 0s - loss: 0.0355 - val_loss: 0.0144\n", | |
"Epoch 62/1000\n", | |
" - 1s - loss: 0.0228 - val_loss: 0.0209\n", | |
"Epoch 63/1000\n", | |
" - 1s - loss: 0.0321 - val_loss: 0.0161\n", | |
"Epoch 64/1000\n", | |
" - 1s - loss: 0.0259 - val_loss: 0.1069\n", | |
"Epoch 65/1000\n", | |
" - 1s - loss: 0.0317 - val_loss: 0.0375\n", | |
"Epoch 66/1000\n", | |
" - 1s - loss: 0.0322 - val_loss: 0.0086\n", | |
"Epoch 67/1000\n", | |
" - 1s - loss: 0.0288 - val_loss: 0.0105\n", | |
"Epoch 68/1000\n", | |
" - 1s - loss: 0.0258 - val_loss: 0.0757\n", | |
"Epoch 69/1000\n", | |
" - 1s - loss: 0.0338 - val_loss: 0.0222\n", | |
"Epoch 70/1000\n", | |
" - 1s - loss: 0.0296 - val_loss: 0.0211\n", | |
"Epoch 71/1000\n", | |
" - 1s - loss: 0.0310 - val_loss: 0.0212\n", | |
"Epoch 72/1000\n", | |
" - 1s - loss: 0.0286 - val_loss: 0.0107\n", | |
"Epoch 73/1000\n", | |
" - 1s - loss: 0.0271 - val_loss: 0.0161\n", | |
"Epoch 74/1000\n", | |
" - 1s - loss: 0.0337 - val_loss: 0.0131\n", | |
"Epoch 75/1000\n", | |
" - 1s - loss: 0.0294 - val_loss: 0.0693\n", | |
"Epoch 76/1000\n", | |
" - 1s - loss: 0.0224 - val_loss: 0.0291\n", | |
"\n", | |
"Epoch 00076: ReduceLROnPlateau reducing learning rate to 9.99999931082e-05.\n", | |
"Epoch 77/1000\n", | |
" - 1s - loss: 0.0043 - val_loss: 0.0020\n", | |
"Epoch 78/1000\n", | |
" - 1s - loss: 0.0024 - val_loss: 0.0019\n", | |
"Epoch 79/1000\n", | |
" - 0s - loss: 0.0032 - val_loss: 0.0091\n", | |
"Epoch 80/1000\n", | |
" - 1s - loss: 0.0032 - val_loss: 0.0039\n", | |
"Epoch 81/1000\n", | |
" - 0s - loss: 0.0029 - val_loss: 0.0067\n", | |
"Epoch 82/1000\n", | |
" - 1s - loss: 0.0036 - val_loss: 0.0041\n", | |
"Epoch 83/1000\n", | |
" - 1s - loss: 0.0037 - val_loss: 0.0028\n", | |
"Epoch 84/1000\n", | |
" - 1s - loss: 0.0034 - val_loss: 0.0042\n", | |
"Epoch 85/1000\n", | |
" - 1s - loss: 0.0039 - val_loss: 0.0038\n", | |
"Epoch 86/1000\n", | |
" - 1s - loss: 0.0030 - val_loss: 7.3419e-04\n", | |
"Epoch 87/1000\n", | |
" - 0s - loss: 0.0036 - val_loss: 0.0010\n", | |
"Epoch 88/1000\n", | |
" - 1s - loss: 0.0038 - val_loss: 0.0027\n", | |
"Epoch 89/1000\n", | |
" - 0s - loss: 0.0037 - val_loss: 0.0023\n", | |
"Epoch 90/1000\n", | |
" - 1s - loss: 0.0029 - val_loss: 0.0106\n", | |
"Epoch 91/1000\n", | |
" - 0s - loss: 0.0035 - val_loss: 0.0035\n", | |
"Epoch 92/1000\n", | |
" - 1s - loss: 0.0035 - val_loss: 0.0024\n", | |
"Epoch 93/1000\n", | |
" - 0s - loss: 0.0029 - val_loss: 0.0036\n", | |
"Epoch 94/1000\n", | |
" - 0s - loss: 0.0032 - val_loss: 0.0039\n", | |
"Epoch 95/1000\n", | |
" - 1s - loss: 0.0032 - val_loss: 0.0018\n", | |
"Epoch 96/1000\n", | |
" - 1s - loss: 0.0031 - val_loss: 0.0030\n", | |
"\n", | |
"Epoch 00096: ReduceLROnPlateau reducing learning rate to 9.99999901978e-06.\n", | |
"Epoch 97/1000\n", | |
" - 0s - loss: 6.5757e-04 - val_loss: 1.3222e-04\n", | |
"Epoch 98/1000\n", | |
" - 1s - loss: 3.5494e-04 - val_loss: 9.8179e-05\n", | |
"Epoch 99/1000\n", | |
" - 1s - loss: 3.3314e-04 - val_loss: 2.2509e-04\n", | |
"Epoch 100/1000\n", | |
" - 0s - loss: 3.2775e-04 - val_loss: 5.0473e-04\n", | |
"Epoch 101/1000\n", | |
" - 0s - loss: 2.4226e-04 - val_loss: 2.3533e-04\n", | |
"Epoch 102/1000\n", | |
" - 1s - loss: 2.8306e-04 - val_loss: 2.7044e-04\n", | |
"Epoch 103/1000\n", | |
" - 0s - loss: 3.7954e-04 - val_loss: 1.4866e-04\n", | |
"Epoch 104/1000\n", | |
" - 0s - loss: 2.8738e-04 - val_loss: 3.1966e-04\n", | |
"Epoch 105/1000\n", | |
" - 0s - loss: 3.9319e-04 - val_loss: 7.6511e-05\n", | |
"Epoch 106/1000\n", | |
" - 1s - loss: 2.9062e-04 - val_loss: 6.7954e-04\n", | |
"Epoch 107/1000\n", | |
" - 1s - loss: 3.6448e-04 - val_loss: 3.6411e-04\n", | |
"\n", | |
"Epoch 00107: ReduceLROnPlateau reducing learning rate to 9.99999883788e-07.\n", | |
"Epoch 108/1000\n", | |
" - 1s - loss: 4.7128e-05 - val_loss: 2.9301e-05\n", | |
"Epoch 109/1000\n", | |
" - 1s - loss: 2.3475e-05 - val_loss: 1.2173e-05\n", | |
"Epoch 110/1000\n", | |
" - 1s - loss: 3.2617e-05 - val_loss: 8.2297e-06\n", | |
"Epoch 111/1000\n", | |
" - 1s - loss: 3.3242e-05 - val_loss: 5.8362e-05\n", | |
"Epoch 112/1000\n", | |
" - 0s - loss: 3.0942e-05 - val_loss: 3.3017e-05\n", | |
"Epoch 113/1000\n", | |
" - 1s - loss: 3.6104e-05 - val_loss: 2.9936e-05\n", | |
"Epoch 114/1000\n", | |
" - 1s - loss: 2.6015e-05 - val_loss: 2.2729e-05\n", | |
"Epoch 115/1000\n", | |
" - 1s - loss: 2.8887e-05 - val_loss: 1.3047e-05\n", | |
"Epoch 116/1000\n", | |
" - 1s - loss: 4.4149e-05 - val_loss: 3.4975e-05\n", | |
"Epoch 117/1000\n", | |
" - 1s - loss: 3.6987e-05 - val_loss: 2.5734e-05\n", | |
"Epoch 118/1000\n", | |
" - 0s - loss: 4.0498e-05 - val_loss: 6.3176e-05\n", | |
"\n", | |
"Epoch 00118: ReduceLROnPlateau reducing learning rate to 9.99999883788e-08.\n", | |
"Epoch 119/1000\n", | |
" - 1s - loss: 8.5613e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 120/1000\n", | |
" - 0s - loss: 4.6026e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 121/1000\n", | |
" - 1s - loss: 6.7542e-06 - val_loss: 6.3893e-06\n", | |
"Epoch 122/1000\n", | |
" - 1s - loss: 5.4063e-06 - val_loss: 9.2913e-06\n", | |
"Epoch 123/1000\n", | |
" - 1s - loss: 7.0408e-06 - val_loss: 8.7770e-06\n", | |
"Epoch 124/1000\n", | |
" - 1s - loss: 6.5823e-06 - val_loss: 8.0083e-06\n", | |
"Epoch 125/1000\n", | |
" - 1s - loss: 5.2226e-06 - val_loss: 4.1434e-06\n", | |
"Epoch 126/1000\n", | |
" - 1s - loss: 6.4519e-06 - val_loss: 1.6645e-05\n", | |
"Epoch 127/1000\n", | |
" - 1s - loss: 7.5108e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 128/1000\n", | |
" - 0s - loss: 6.9363e-06 - val_loss: 4.5268e-06\n", | |
"\n", | |
"Epoch 00128: ReduceLROnPlateau reducing learning rate to 9.99999869578e-09.\n", | |
"Epoch 129/1000\n", | |
" - 0s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 130/1000\n", | |
" - 0s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 131/1000\n", | |
" - 0s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 132/1000\n", | |
" - 0s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 133/1000\n", | |
" - 0s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 134/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 135/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Epoch 136/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 137/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 138/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"\n", | |
"Epoch 00138: ReduceLROnPlateau reducing learning rate to 9.99999905105e-10.\n", | |
"Epoch 139/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 140/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 141/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 142/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 143/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 144/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n", | |
"Epoch 145/1000\n", | |
" - 1s - loss: 4.5387e-06 - val_loss: 4.5268e-06\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"<keras.callbacks.History at 0x135266690>" | |
] | |
}, | |
"execution_count": 20, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"model.fit(alphas, xts, batch_size=1, epochs=1000, validation_split=0.5, verbose=2, \n", | |
" callbacks=[keras.callbacks.EarlyStopping(patience=20),\n", | |
" keras.callbacks.ReduceLROnPlateau(patience=10, verbose=1)])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Text(0.5,1,'Error plot')" | |
] | |
}, | |
"execution_count": 21, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ8AAAEICAYAAACAgflvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3X+QHOV95/H3Vyut8ErGSCMdxgJWEJNLxF1CzBpwpeLjLMyvSiyq4rO5W0BgbAXJuXDnS8qQTY4cPt3Zl6pgSCzwBmNL7CYGO5dYSXBUQrEvrpTBLD7MrxzWgiUhGRtpxQ+DHIPQ9/54nvb2znbP7+mZnf28qrp2pufpp7t3Zue73c/3eR5zd0RERIq0oNMHICIi84+Cj4iIFE7BR0RECqfgIyIihVPwERGRwin4iIhI4RR8ROYJM/uCmf33Th+HCCj4iLSEme0xsx+b2Sup5U86fVyNMjM3s7d3+jikdy3s9AGI9JBfc/f7qxUys4XufrTaunrrEJlLdOUj0mZmdrWZ/aOZ3WJmU8Af5KxbYGa/Z2Z7zex5M9tmZm+JdayOVyPXmtk+4O8z9nO+me03s981s0Pxamy4wnF9xMwmzeywmW03s7fF9f8Qi3wnXsF9sPW/FZnvFHxEinEu8AxwIrA5Z93Vcfm3wOnAUqD81t2/AX4euChnP28FVgCrgPXAqJn9y/JCZvYe4H8CHwBOAvYCXwRw93fHYr/o7kvd/Z66zlSk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P4Y+KsOH09LmNlS4C+A/+TuL3f6eIpQ5Zx78n2uhYJP9zkApK9kTo7rfsrdp9z9J/HpncDZBR1bp1T9nfQad3/Z3V+Jj+8DFpnZig4fVlPMbBHhS3jc3f93RpGee5+rnXMvvs+1UvDpPg8BZ5jZaWbWD1wObE8XKLsP/j7CveReth24KmZDnQe85O7Pdfqg2snM3mpmFh+fQ/hbnersUTUunsvngH9y9z/KKdZT73Mt59xr73M9lO3WZdz9qJn9JrAD6APucvcnzOxmYMLdtwO/ZWbvI2TTHAau7tgBt4CZ/TlwPrDCzPYDNwGLANz9DuA+4FJgEjgCXNOZI22dGs75/cBGMzsK/Bi43Of2cCS/DFwJPGZmj8R1vwucCj37Ptdyzr32PtdMw+uIiEjhdNtNREQKp+AjIiKFU/AREZHCKfiIiEjhFHxERKRwCj4iIlI4BR8RESnc/weGhW4taVu62wAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"plt.plot(alphas, xts - np.reshape(model.predict(alphas), [N]), 'ro')\n", | |
"plt.title('Error plot')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.15" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment