Skip to content

Commit

Permalink
Json
Browse files Browse the repository at this point in the history
  • Loading branch information
harinisuresh committed Jan 28, 2017
1 parent c797c5d commit 072e267
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions 6.S191 Lab 2.ipynb
Expand Up @@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"collapsed": true
},
Expand All @@ -23,7 +23,8 @@
"import pickle as p\n",
"import tensorflow as tf\n",
"import numpy as np\n",
"import utils"
"import utils\n",
"import json"
]
},
{
Expand Down Expand Up @@ -296,7 +297,10 @@
"tf.global_variables_initializer().run(session=session)\n",
"\n",
"# load our data and separate it into tweets and labels\n",
"train_data = p.load(open('data/trainTweets_preprocessed.p','rb'))\n",
"train_data = json.load(open('data/trainTweets_preprocessed.json', 'rb'))\n",
"train_data = map(lambda row:(np.array(row[0],dtype=np.int32),str(row[1])),train_data3)\n",
"\n",
"#train_data = p.load(open('data/trainTweets_preprocessed.p','rb'))\n",
"train_tweets = np.array([t[0] for t in train_data])\n",
"train_labels = np.array([int(t[1]) for t in train_data])\n",
"\n",
Expand Down Expand Up @@ -446,7 +450,8 @@
"tf.global_variables_initializer().run(session=session)\n",
"\n",
"# load our data and separate it into tweets and labels\n",
"train_data = p.load(open('data/trainTweets_preprocessed.p','rb'))\n",
"train_data = json.load(open('data/trainTweets_preprocessed.json', 'rb'))\n",
"train_data = map(lambda row:(np.array(row[0],dtype=np.int32),str(row[1])),train_data3)\n",
"train_tweets = np.array([t[0] for t in train_data])\n",
"train_labels = np.array([int(t[1]) for t in train_data])\n",
"\n",
Expand Down
1 change: 1 addition & 0 deletions data/testTweets_preprocessed.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions data/trainTweets_preprocessed.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lab1_utils.py
Expand Up @@ -2,7 +2,7 @@
import pandas as pd
import re
import special_tokens
import np
import numpy as np
import random
import tensorflow as tf
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -181,7 +181,7 @@ def classify_and_plot(data, labels, x, out, session):
# print('ec', int(decision), int(label))
# print('ec2', decision, label)
# print(int(decision) is int(label))
m_text = 'g' if int(decision) is int(label) else 'r'
m_text = 'g' if int(decision) == int(label) else 'r'
m_text += '_' if label == 0 else '+'
plt.plot(x_input[0], x_input[1], m_text, markersize=10)

Expand Down

0 comments on commit 072e267

Please sign in to comment.