Skip to content
Open
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
54 changes: 24 additions & 30 deletions 3-logreg-nb-imdb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2141,9 +2141,7 @@
{
"cell_type": "code",
"execution_count": 189,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -2842,6 +2840,16 @@
"negative = y.c2i['negative']"
]
},
{
"cell_type": "code",
"execution_count": 289,
"metadata": {},
"outputs": [],
"source": [
"p1 = np.squeeze(np.asarray(x[y.items==positive].sum(0)))\n",
"p0 = np.squeeze(np.asarray(x[y.items==negative].sum(0)))"
]
},
{
"cell_type": "code",
"execution_count": 284,
Expand All @@ -2862,6 +2870,15 @@
"len(p1), len(p0)"
]
},
{
"cell_type": "code",
"execution_count": 291,
"metadata": {},
"outputs": [],
"source": [
"v = movie_reviews.vocab"
]
},
{
"cell_type": "code",
"execution_count": 285,
Expand Down Expand Up @@ -2949,16 +2966,6 @@
"For each word in our vocabulary, we are summing up how many positive reviews it is in, and how many negative reviews."
]
},
{
"cell_type": "code",
"execution_count": 289,
"metadata": {},
"outputs": [],
"source": [
"p1 = np.squeeze(np.asarray(x[y.items==positive].sum(0)))\n",
"p0 = np.squeeze(np.asarray(x[y.items==negative].sum(0)))"
]
},
{
"cell_type": "code",
"execution_count": 290,
Expand All @@ -2979,15 +2986,6 @@
"p1[:10]"
]
},
{
"cell_type": "code",
"execution_count": 291,
"metadata": {},
"outputs": [],
"source": [
"v = movie_reviews.vocab"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -6770,9 +6768,7 @@
{
"cell_type": "code",
"execution_count": 236,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -6824,9 +6820,7 @@
{
"cell_type": "code",
"execution_count": 251,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -7062,9 +7056,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}