Skip to content

Commit

Permalink
clear homework outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhangDesai committed Apr 18, 2018
1 parent 8bd7a7d commit 2b65868
Showing 1 changed file with 9 additions and 32 deletions.
41 changes: 9 additions & 32 deletions unit2/Week3_Homework.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -25,7 +25,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Here, we're going to use the simple intuition behind word2vec to create our own word vectors--and discover how easy it is to make something horrifying on accident. Our training data is vector representations of an article on crime and race from Wikipedia, a seemingly unbiased source.\n",
"Here, we're going to use the simple intuition behind word2vec to create our own word vectors--and discover how easy it is to make something horrifying on accident. Our training data is vector representations of an article on crime and race from Wikipedia, a seemingly unbiased source. Here's the link: https://en.wikipedia.org/wiki/Race_and_crime_in_the_United_States\n",
"\n",
"## Forward and Backward Passes\n",
"\n",
Expand All @@ -34,7 +34,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -74,26 +74,14 @@
"source": [
"## Training\n",
"\n",
"We have written the training scrip for you below. Run it to train the model for one epoch."
"We have written the training script for you below. Run it to train the model for one epoch."
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "unsupported operand type(s) for *: 'float' and 'NoneType'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-c75a9bfab373>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mdW1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdW2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mbackward_pass\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0mW1\u001b[0m \u001b[0;34m-=\u001b[0m \u001b[0;36m1e-2\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mdW1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0mW2\u001b[0m \u001b[0;34m-=\u001b[0m \u001b[0;36m1e-2\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mdW2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for *: 'float' and 'NoneType'"
]
}
],
"outputs": [],
"source": [
"N, D = x.shape[1], 70\n",
"batch_size = 2\n",
Expand Down Expand Up @@ -124,20 +112,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hispanic is most illegal group\n",
"black is second most illegal group\n",
"white is third most illegal group\n",
"asian is least illegal group\n"
]
}
],
"outputs": [],
"source": [
"def word2vec(word):\n",
" return W1[indexes.index(word)]\n",
Expand Down

0 comments on commit 2b65868

Please sign in to comment.