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
75 changes: 41 additions & 34 deletions Module 1/Getting Familiar with Numpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
Expand All @@ -34,20 +32,17 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"matrix([[1., 1., 1.],\n",
" [1., 1., 1.],\n",
" [1., 1., 1.]])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"[[1. 1. 1.]\n",
" [1. 1. 1.]\n",
" [1. 1. 1.]]\n"
]
}
],
"source": [
Expand All @@ -63,17 +58,25 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[1. 0. 0.]\n",
" [0. 1. 0.]\n",
" [0. 0. 1.]]\n"
]
}
],
"source": [
"# ====================== YOUR CODE HERE ======================\n",
"# Instructions: Generate a 3x3 Identity matrix using numpy\n",
" \n",
" \n",
" \n",
"a=np.matrix(np.eye(3))\n",
"print(a) \n",
" \n",
" \n",
" \n",
Expand Down Expand Up @@ -101,14 +104,12 @@
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": true
},
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"X = np.matrix([5,5]).transpose()\n",
"theta = np.matrix([2,2]).transpose()"
"theta = np.matrix([2,2]).transpose()\n"
]
},
{
Expand All @@ -120,17 +121,23 @@
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": true
},
"outputs": [],
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[20]]\n"
]
}
],
"source": [
"# ====================== YOUR CODE HERE ======================\n",
"# Instructions: Multiply theta transpose by X\n",
" \n",
" \n",
" \n",
"print(np.dot(theta.T,X))\n",
" \n",
" \n",
" \n",
Expand Down Expand Up @@ -164,7 +171,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.7.0"
}
},
"nbformat": 4,
Expand Down
Loading