Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
395 changes: 395 additions & 0 deletions Class15/.ipynb_checkpoints/Autoencoder_Sequential-checkpoint.ipynb

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Class15/.ipynb_checkpoints/Practice-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
25 changes: 17 additions & 8 deletions Class15/Autoencoder_Sequential.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
"cells": [
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -150,7 +158,7 @@
"metadata": {},
"outputs": [],
"source": [
"AutoEncoder.compile(optimizer='adam', loss='mse')"
"AutoEncoder.compile(optimizer='adam', loss='mse')## Doubt"
]
},
{
Expand Down Expand Up @@ -359,6 +367,7 @@
],
"source": [
"out = AutoEncoder.predict( np.array([sample]) )\n",
"print(out)\n",
"out = np.array( out[0]*255, dtype=np.uint8 )\n",
"plt.imshow( np.reshape(out, (28,28) ), cmap='gray' )"
]
Expand All @@ -373,21 +382,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15"
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
Expand Down
30 changes: 15 additions & 15 deletions Class15/Classification_on_MNIST.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,24 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 [0. 1. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
"0 [1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
"0 [1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
"8 [0. 0. 0. 0. 0. 0. 0. 0. 1. 0.]\n",
"9 [0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]\n"
"ename": "NameError",
"evalue": "name 'Y_test' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-2-e412f025016e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mix\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mY_test\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mix\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mNameError\u001b[0m: name 'Y_test' is not defined"
]
}
],
"source": [
"for ix in range(5):\n",
" print y_test[ix], Y_test[ix]"
" print(Y_test[ix])"
]
},
{
Expand Down Expand Up @@ -410,21 +410,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15"
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
Expand Down
98 changes: 98 additions & 0 deletions Class15/Kernel Coding.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"def KernelMultiply(K,M):\n",
" matrix_size = M.shape[0]\n",
" kernel_size = K.shape[0]\n",
" new_matrix = np.zeros((matrix_size-kernel_size+1,matrix_size-kernel_size+1))\n",
" for ix in list(range(new_matrix.shape[0])):\n",
" for jx in list(range(new_matrix.shape[1])):\n",
" for ax in list(range(ix,ix+K.shape[0])):\n",
" for bx in list(range(jx,jx+K.shape[1])):\n",
" new_matrix[ix][jx] += M[ax][bx]*K[ix][jx]\n",
" \n",
" return new_matrix"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"K= np.array(([1,1],[1,1]))\n",
"M = np.array(([1,1,1],[1,1,1],[1,1,1]))"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"S = KernelMultiply(K,M)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[4. 4.]\n",
" [4. 4.]]\n"
]
}
],
"source": [
"print(S)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"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.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading