Пример #1
0
print len(url_nofilt)
statis_helper = util.statis(None)
statis_helper.setArray([sum(x) for x in url_filt.values()])
print statis_helper.getreport()
statis_helper.setArray([sum(x) for x in url_nofilt.values()])
print(statis_helper.getreport())

'''
 one account avg single tweet amount daily trend
'''

from PlotView import PlotView
import operator
from util import statis

painter = PlotView()
statis_helper = statis(None)
def elementAdd(l1, l2):
        if len(l1) > len(l2):
            return elementAdd(l2, l1)
        return map(add,l1, l2[:len(l1)])+l2[len(l1):]
def elementDiv(l, d):
    if d == 0:
        return l
    return [it*1.0/d for it in l]

for acn, datedict in acnt_date.items():
    painter.setAcntName(acn)
    '''
        xlabel means std
    '''
Пример #2
0
statis_helper = util.statis(None)
avg_filt = [[t[0]/t[1] for t in xlist] for xlist in url_filt.values()]
sum_filt = [reduce(lambda x,y: x+y[0], xlist,0 ) for xlist in url_filt.values()]
statis_helper.setArray(sum_filt)
print statis_helper.getreport()
avg_nofilt =  [[t[0]/t[1] for t in xlist] for xlist in url_nofilt.values()]
sum_nofilt = [reduce(lambda x,y: x+y[0], xlist,0 ) for xlist in url_nofilt.values()]
statis_helper.setArray(sum_nofilt)
print(statis_helper.getreport())


from PlotView import PlotView
import operator
from util import statis

painter = PlotView()
statis_helper = statis(None)
def elementAdd(l1, l2):
        if len(l1) > len(l2):
            return elementAdd(l2, l1)
        return map(add,l1, l2[:len(l1)])+l2[len(l1):]
def elementDiv(l, d):
    if d == 0:
        return l
    return [it*1.0/d for it in l]
'''
first we want to find some pattern url_filt
do classification using kmeans
then plot the centra
'''
# from sklearn.cluster import KMeans