Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy and linear regression #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
90 changes: 67 additions & 23 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": 18,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
Expand All @@ -34,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 19,
"metadata": {},
"outputs": [
{
Expand All @@ -45,7 +43,7 @@
" [1., 1., 1.]])"
]
},
"execution_count": 6,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -63,15 +61,26 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"matrix([[1., 0., 0.],\n",
" [0., 1., 0.],\n",
" [0., 0., 1.]])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# ====================== YOUR CODE HERE ======================\n",
"# Instructions: Generate a 3x3 Identity matrix using numpy\n",
" \n",
"np.matrix(np.eye(3,3))\n",
" \n",
" \n",
" \n",
Expand Down Expand Up @@ -101,10 +110,8 @@
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": true
},
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"X = np.matrix([5,5]).transpose()\n",
Expand All @@ -120,15 +127,24 @@
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": true
},
"outputs": [],
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"matrix([[20]])"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# ====================== YOUR CODE HERE ======================\n",
"# Instructions: Multiply theta transpose by X\n",
" \n",
"np.matrix(np.dot(theta.T,X))\n",
" \n",
" \n",
" \n",
Expand All @@ -146,6 +162,34 @@
"matrix([[20]])\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -164,7 +208,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.7.0"
}
},
"nbformat": 4,
Expand Down
Loading