Skip to content

Instantly share code, notes, and snippets.

@thearn
Created June 8, 2017 19:20
Show Gist options
  • Save thearn/be9f98c5c2a6f87068490808f374a07c to your computer and use it in GitHub Desktop.
Save thearn/be9f98c5c2a6f87068490808f374a07c to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"import keras\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from keras.layers import Dense, Dropout, Activation\n",
"from keras.models import Sequential\n",
"import keras.backend as K\n",
"import tensorflow as tf\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Define model & data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x126bf4eb8>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd8VFXex/HPmVRCQigJJT1AkBYSIBQp0iwUFVFENKjs\nollA1HVdVDYKi2v2cVddsCEGRF2JIFj2EUVBdBEQkGboLUAaLYGQEAipc54/EvKEkDLAZG5m8nu/\nXr5ezJ2Tub9r9MuZe09RWmuEEEI4FpPRBQghhLA+CXchhHBAEu5CCOGAJNyFEMIBSbgLIYQDknAX\nQggHJOEuhBAOSMJdCCEckIS7EEI4IGejTuzj46NDQkKMOr0QQtil7du3n9Fa+9bWzrBwDwkJYdu2\nbUadXggh7JJSKsWSdnJbRgghHJCEuxBCOCAJdyGEcECG3XMX9q+oqIj09HTy8/ONLkVYwN3dnYCA\nAFxcXIwuRdiAhLu4bunp6Xh5eRESEoJSyuhyRA201pw9e5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HJNb8DdAJOALuBp7XWZtuUZ4g6zS+bbpAtrEcpNYTScB9gdC02\nMBd4XmttLu3UNQjOQE9gGNAI2KSU2qy1PmRsWXXqDiARGAq0A35QSq3XWp83tiz7VJ/D3Wobc9sR\ni65HKdUNWAiM0FqftVFtdcWSa44ClpYFuw8wUilVrLX+j21KtDpLrjkdOKu1vghcVEqtAyIAew13\nS675d8CruvSGdJJS6hjQEdhimxJtrk7zqz7flmmIG3PXes1KqSDgS+BhB+nF1XrNWutQrXWI1joE\n+ByYasfBDpb9t/2/wACllLNSygPoQ+kexvbKkmtOpfSbCkqpVsBNlO7N7KjqNL/qbc9da12slLq8\nMbcTsEiXbcxd9v58SkdOjKR0Y+48Sv/mt1sWXvNMoAUwr6wnW6zteNElC6/ZoVhyzVrr/Uqp74Fd\ngBlYqLWuckidPbDw9/w34COl1G5KR5A8r7W229UilVJLgMGAj1IqHZgFuIBt8ktmqAohhAOqz7dl\nhBBCXCcJdyGEcEAS7kII4YAk3IUQwgFJuAshhAOScBdCCAck4S6EEA5Iwl0IIRzQ/wEATEdw+M/I\n6QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x124619278>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"def f(x):\n",
" # quadratic\n",
" return ((x - 5)**2)/25.0\n",
"\n",
"def df(x):\n",
" # derivative of quadratic is linear\n",
" return 2*(x - 5) / 25.0\n",
"\n",
"# sample size\n",
"n = 1000\n",
"# these will be my training data sets, with regular sampling\n",
"x = np.linspace(0,10,n)\n",
"y = f(x)\n",
"\n",
"# normalize\n",
"x = x / 10\n",
"\n",
"# get test data too, but randomly sampled\n",
"x_test = 10*np.random.ranf(20)\n",
"y_test = f(x_test)\n",
"x_test = x_test / 10\n",
"\n",
"plt.plot(x,y, label='training points')\n",
"plt.plot(x_test,y_test, 'ko', label='test data')\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Define and run tiny nonlinear regression NN"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<keras.callbacks.History at 0x127033e48>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = Sequential()\n",
"# 1d input\n",
"model.add(Dense(64, input_dim=1, activation='relu'))\n",
"model.add(Activation(\"linear\"))\n",
"model.add(Dense(32, activation='relu'))\n",
"model.add(Activation(\"linear\"))\n",
"model.add(Dense(32, activation='relu'))\n",
"# 1d output\n",
"model.add(Dense(1))\n",
"\n",
"# minimize mse\n",
"model.compile(loss='mse', optimizer='adam', metrics=[\"accuracy\"])\n",
"\n",
"\n",
"model.fit(x, y,\n",
" batch_size=10,\n",
" epochs=25,\n",
" verbose=0,\n",
" validation_data=(x_test, y_test))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot performance (not bad, not perfect but really just an example model)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x127386f60>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VOX5//H3nZ2QhSVhzQqyRXbCIouCqAUVAQsUDe4S\ngbq19VdssVWrtFqrIm4YF7QSRRG1olYrKLIvAYGArEI2ARMIhMCQdZ7fHwl8AwQywMycmcn9ui6u\nizlzZuY+CXxy8pzn3I8YY1BKKeVb/KwuQCmllPNpuCullA/ScFdKKR+k4a6UUj5Iw10ppXyQhrtS\nSvkgDXellPJBGu5KKeWDNNyVUsoHBVj1wVFRUSYhIcGqj1dKKa+0bt26A8aY6Lr2syzcExISyMjI\nsOrjlVLKK4lItiP76bCMUkr5IA13pZTyQRruSinlgzTclVLKB2m4K6WUD6oz3EXkLRH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7gI7AGveU6HYuzS9PHpapjwtz13nMIhIHfAzc\n4iNncXUeszEm0RiTYIxJAD4CpnhxsINj/7b/AwwUkQARCQX6AlvdXKczOXLMOVT9poKINAc6ALvd\nWqV7uTS/PPbM3bh5YW5P4OAx/xVoCrxSfSZbYby46ZKDx+xTHDlmY8xWEfkK2ATYgTeMMbVOqfMG\nDn6fnwDeFpFMqmaQTDXGeG23SBF5HxgMRIlIHvAoEAjuyS+9Q1UppXyQJw/LKKWUukAa7kop5YM0\n3JVSygdpuCullA/ScFdKKR+k4a6UUj5Iw10ppXyQhrtSSvmg/w+D4jsJGT3wNAAAAABJRU5ErkJg\ngg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x124622860>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"y_result = model.predict(x_test)\n",
"plt.plot(x,y, label='exact')\n",
"plt.plot(x_test, y_result, 'go', label='predictions')\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Derivatives\n",
"I know Theano/TF are built around the idea of easily getting derivatives of loss functions w.r.t weights. But what I specifically want to extract is what the model things dy/dx is at a given point"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x124622400>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl0FHX29/H3BQIh7IEEghDDvkOEsIiICIgIKgKKCyou\niMvsvxkhCoqIS3CY0dHRYRhGBkcdQcKOKIsgiIIQhSTsW4BA2MIayN73+SMFD8TEBDpJpzv3dU4O\nVV3f6rqVaH+6qrpviapijDHGXFTO0wUYY4wpXSwYjDHGXMGCwRhjzBUsGIwxxlzBgsEYY8wVLBiM\nMcZcwYLBGGPMFSw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+i8h1\nwGDgHyVYV3EpzN+4OVBLRFaJSIyIPFpi1RWPwuzz34FWwGEgDvidqrpKpjyPKdbXL7du1GO8k4jc\nSk4w9PB0LSXgHWCMqrpy3lD6vApAJ3JugFUZ+F5E1qnqTs+WVaxuBzYBvYEmwDIRWaOqZz1blvfy\n1WA4BDS8bL6B89jVjvEmhdofEWkPTAPu0Jw76HmzwuxzBPCZEwp1gAEikqWq80qmxCJVmP1NBJJV\n9TxwXkRWAx0Abw2Gwuzz40CU5px83y0i+4CWwA8lU6JHFOvrl6+eStoANBORRiJSEXgAWJBrzALg\nUefqfjfgjKomlXShRajAfRaRUGAO8IiPvIMscJ9VtZGqhqlqGDAbeM5LQwEK99/1fKCHiFQQkQCg\nK7CthOssSoXZ5wM4twgWkbpAC2BviVZZ8or19csnjxhUNUtEfg18Rc6nGj5U1S0i8oyzfAo5n1AZ\nAOwGLpDzrsNrFXKfXwZqAx8476Cz1IsbkBVyn31GYfZXVbeJyJdALOACpqlqnh959AaF/BtPBP4j\nInHkfEpnjKp6dcdVEfkf0AuoIyKJwHjAD0rm9cu++WyMMeYKvnoqyRhjzDWyYDDGGHMFCwZjjDFX\nsGAwxhhzBQsGY4wxV7BgMMYYcwULBmOMMVewYDDGGHOF/wfVThtBZ4GtcAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x1246226a0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.plot(x, df(x), label='dy/dx exact')\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Not sure where to start though... almost everything that I see is based on getting d_loss / d_weight\n",
"\n",
"I could work with that on the first layer though, using the chain rule\n",
"\n",
"Just shooting in the dark down below"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"weights = model.trainable_weights # weight tensors\n",
"weights = [weight for weight in weights] # filter down weights tensors to only ones which are trainable\n",
"gradients = model.optimizer.get_gradients(model.output, weights) # gradient tensors\n",
"\n",
"input_tensors = [model.inputs[0], # input data\n",
"]\n",
"\n",
"get_gradients = K.function(inputs=input_tensors, outputs=gradients)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "Cannot feed value of shape (1000,) for Tensor 'dense_1_input:0', which has shape '(?, 1)'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-44-7d09280de900>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mget_gradients\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/Users/tahearn1/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 2227\u001b[0m \u001b[0msession\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_session\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2228\u001b[0m updated = session.run(self.outputs + [self.updates_op],\n\u001b[0;32m-> 2229\u001b[0;31m feed_dict=feed_dict)\n\u001b[0m\u001b[1;32m 2230\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mupdated\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2231\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Users/tahearn1/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 776\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 777\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[0;32m--> 778\u001b[0;31m run_metadata_ptr)\n\u001b[0m\u001b[1;32m 779\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 780\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Users/tahearn1/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run\u001b[0;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 959\u001b[0m \u001b[0;34m'Cannot feed value of shape %r for Tensor %r, '\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 960\u001b[0m \u001b[0;34m'which has shape %r'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 961\u001b[0;31m % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))\n\u001b[0m\u001b[1;32m 962\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_feedable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubfeed_t\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 963\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Tensor %s may not be fed.'\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0msubfeed_t\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mValueError\u001b[0m: Cannot feed value of shape (1000,) for Tensor 'dense_1_input:0', which has shape '(?, 1)'"
]
}
],
"source": [
"\n",
"get_gradients([x])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"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.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@Albmargar1
Copy link

Hi, got the same error... did you find the solution?

@kdneal
Copy link

kdneal commented Mar 23, 2020

I found a solution. See link below, or follow my fork of this code.
https://gist.github.com/kdneal/c86ce4c00e547efa362854ed729f5e0f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment