From a9b867a9459e8268c090881db2a558043201bcfd Mon Sep 17 00:00:00 2001 From: CarlosP97 Date: Mon, 15 Jan 2018 18:54:33 -0500 Subject: [PATCH] First exercise --- .../Broadcasting demo-checkpoint.ipynb | 122 ++++++++++++++ .../Python-Numpy Vectors-checkpoint.ipynb | 151 ++++++++++++++++++ .../Untitled-checkpoint.ipynb | 6 - .../Basics/Broadcasting demo.ipynb | 30 +++- .../Basics/Python-Numpy Vectors.ipynb | 151 ++++++++++++++++++ .../Basics/Untitled.ipynb | 6 - README.md | 3 +- 7 files changed, 452 insertions(+), 17 deletions(-) create mode 100644 1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Broadcasting demo-checkpoint.ipynb create mode 100644 1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Python-Numpy Vectors-checkpoint.ipynb delete mode 100644 1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Untitled-checkpoint.ipynb create mode 100644 1. Neural Networks and Deep Learning /Basics/Python-Numpy Vectors.ipynb delete mode 100644 1. Neural Networks and Deep Learning /Basics/Untitled.ipynb diff --git a/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Broadcasting demo-checkpoint.ipynb b/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Broadcasting demo-checkpoint.ipynb new file mode 100644 index 0000000..161e7dd --- /dev/null +++ b/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Broadcasting demo-checkpoint.ipynb @@ -0,0 +1,122 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.13173302 7.80728589 6.26190867 7.2219721 ]\n", + " [ 4.34703125 7.83297 9.41237969 7.4847714 ]\n", + " [ 1.91750257 9.10735505 1.12573619 7.93226677]]\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "\n", + "A = 10*np.random.rand(3,4)\n", + "print(A)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 18.75768804 13.9073695 21.41652281 15.24013189]\n" + ] + } + ], + "source": [ + "cal = A.sum(axis=0)\n", + "print(cal)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 29.81471408 50.34378724 36.86021364 64.43175012]\n", + " [ 26.96686398 38.48118926 33.10381054 11.96405678]\n", + " [ 43.21842194 11.1750235 30.03597582 23.6041931 ]]\n" + ] + } + ], + "source": [ + "percentage = 100*A/(cal.reshape(1,4))\n", + "print(percentage)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(3, 3)\n" + ] + } + ], + "source": [ + "a = np.random.randn(3, 3)\n", + "b = np.random.randn(3, 1)\n", + "c = a*b\n", + "print (c.shape)" + ] + }, + { + "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.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Python-Numpy Vectors-checkpoint.ipynb b/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Python-Numpy Vectors-checkpoint.ipynb new file mode 100644 index 0000000..9b8b1ce --- /dev/null +++ b/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Python-Numpy Vectors-checkpoint.ipynb @@ -0,0 +1,151 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.60389225]\n", + " [ 0.6429397 ]\n", + " [ 0.35553732]\n", + " [ 0.11588369]\n", + " [ 0.44658051]]\n", + "(5, 1)\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "\n", + "a = np.random.rand(5,1)\n", + "print (a)\n", + "print (a.shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.60389225 0.6429397 0.35553732 0.11588369 0.44658051]]\n" + ] + } + ], + "source": [ + "print (a.T)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.36468585 0.3882663 0.21470623 0.06998126 0.26968651]\n", + " [ 0.3882663 0.41337146 0.22858906 0.07450623 0.28712434]\n", + " [ 0.21470623 0.22858906 0.12640679 0.04120098 0.15877604]\n", + " [ 0.06998126 0.07450623 0.04120098 0.01342903 0.0517514 ]\n", + " [ 0.26968651 0.28712434 0.15877604 0.0517514 0.19943415]]\n" + ] + } + ], + "source": [ + "print(np.dot(a,a.T))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import math\n", + "def basic_sigmoid(x):\n", + " \"\"\"\n", + " Compute sigmoid of x.\n", + "\n", + " Arguments:\n", + " x -- A scalar\n", + "\n", + " Return:\n", + " s -- sigmoid(x)\n", + " \"\"\"\n", + " s = 1/(1+math.exp(-x))\n", + "\n", + " \n", + " return s" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.9933071490757153" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "basic_sigmoid(5)" + ] + }, + { + "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.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Untitled-checkpoint.ipynb deleted file mode 100644 index 2fd6442..0000000 --- a/1. Neural Networks and Deep Learning /Basics/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/1. Neural Networks and Deep Learning /Basics/Broadcasting demo.ipynb b/1. Neural Networks and Deep Learning /Basics/Broadcasting demo.ipynb index 1c7e5fe..161e7dd 100644 --- a/1. Neural Networks and Deep Learning /Basics/Broadcasting demo.ipynb +++ b/1. Neural Networks and Deep Learning /Basics/Broadcasting demo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "collapsed": false }, @@ -11,9 +11,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "[[ 5.59255106 7.00149651 7.89417606 9.8194837 ]\n", - " [ 5.05836022 5.35172118 7.08968514 1.82333803]\n", - " [ 8.10677676 1.55415181 6.43266161 3.59731016]]\n" + "[[ 0.13173302 7.80728589 6.26190867 7.2219721 ]\n", + " [ 4.34703125 7.83297 9.41237969 7.4847714 ]\n", + " [ 1.91750257 9.10735505 1.12573619 7.93226677]]\n" ] } ], @@ -66,6 +66,28 @@ "print(percentage)" ] }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(3, 3)\n" + ] + } + ], + "source": [ + "a = np.random.randn(3, 3)\n", + "b = np.random.randn(3, 1)\n", + "c = a*b\n", + "print (c.shape)" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/1. Neural Networks and Deep Learning /Basics/Python-Numpy Vectors.ipynb b/1. Neural Networks and Deep Learning /Basics/Python-Numpy Vectors.ipynb new file mode 100644 index 0000000..9b8b1ce --- /dev/null +++ b/1. Neural Networks and Deep Learning /Basics/Python-Numpy Vectors.ipynb @@ -0,0 +1,151 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.60389225]\n", + " [ 0.6429397 ]\n", + " [ 0.35553732]\n", + " [ 0.11588369]\n", + " [ 0.44658051]]\n", + "(5, 1)\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "\n", + "a = np.random.rand(5,1)\n", + "print (a)\n", + "print (a.shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.60389225 0.6429397 0.35553732 0.11588369 0.44658051]]\n" + ] + } + ], + "source": [ + "print (a.T)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 0.36468585 0.3882663 0.21470623 0.06998126 0.26968651]\n", + " [ 0.3882663 0.41337146 0.22858906 0.07450623 0.28712434]\n", + " [ 0.21470623 0.22858906 0.12640679 0.04120098 0.15877604]\n", + " [ 0.06998126 0.07450623 0.04120098 0.01342903 0.0517514 ]\n", + " [ 0.26968651 0.28712434 0.15877604 0.0517514 0.19943415]]\n" + ] + } + ], + "source": [ + "print(np.dot(a,a.T))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import math\n", + "def basic_sigmoid(x):\n", + " \"\"\"\n", + " Compute sigmoid of x.\n", + "\n", + " Arguments:\n", + " x -- A scalar\n", + "\n", + " Return:\n", + " s -- sigmoid(x)\n", + " \"\"\"\n", + " s = 1/(1+math.exp(-x))\n", + "\n", + " \n", + " return s" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.9933071490757153" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "basic_sigmoid(5)" + ] + }, + { + "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.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/1. Neural Networks and Deep Learning /Basics/Untitled.ipynb b/1. Neural Networks and Deep Learning /Basics/Untitled.ipynb deleted file mode 100644 index 2fd6442..0000000 --- a/1. Neural Networks and Deep Learning /Basics/Untitled.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/README.md b/README.md index 1a44209..d3e7379 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# Deep-Learning-Specialization +# Deep Learning Specialization +Course work for [Deep Learning AI](https://www.deeplearning.ai/)'s Specialization