In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns


/home/tbsexton/anaconda/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)

In [2]:
from preprocess import Preprocess
from analysis import *

In [3]:
pre = Preprocess('../tweet_input/tweets.txt')
pre.extract()


Parsing JSON objects...
Done!
Parsed 9295 Tweets.
Dropped 704 Tweets with missing information.
Total tweets in storage: 9295

In [4]:
len(pre.df.index)


Out[4]:
9295

In [42]:
# from itertools import islice, dropwhile
# islice()
# all_graphs(df, window=10.)
tweet_no = 11
g = get_graphs(pre.df, tweet_no,tweet_no+1, window=10.)
print len(g)
draw_lifted(g[0])



1

In [ ]:
get_times = lambda g: g.graph['time'] 

graph_gen = rolled_graph_gen(pre.df, start=8000, window=10.)
X = g_stats(graph_gen, mean_deg, get_times)

In [29]:
degrees, times = X[:,0], X[:,1]

plt.plot(degrees)


Out[29]:
[<matplotlib.lines.Line2D at 0x7f07a8dd4cd0>]

In [30]:
plt.plot(times, degrees, '.')
plt.xticks(rotation=20)
# X.shape


Out[30]:
(array([ 736052.25309028,  736052.25314815,  736052.25320602,
         736052.25326389,  736052.25332176]),
 <a list of 5 Text xticklabel objects>)

In [31]:
sns.distplot(degrees)


Out[31]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f0782871d50>

In [28]:
graph_list = get_graphs(pre.df, window=10.)




In [32]:
draw_lifted(graph_list[0])



In [33]:
X = g_stats(graph_list, mean_deg, get_times)
degrees, times = X[:,0], X[:,1]

g = graph_list[np.argmax([degrees])]
print g.degree().values()

draw_lifted(g)


keyword not recognized. Input savename='path/to/file.txt'.
[7, 7, 7, 7, 7, 7, 7, 7]

In [34]:
g = graph_list[np.argmin([degrees])]
print g.degree().values()

draw_lifted(g)


[1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1]

In [ ]: