コード例 #1
0
# and M[i] returns all measurements on metric i

pca = g.PCA(M)
pca.plot()

###  Make network PCA with partitions ###
dl = g.DownloadGmaneData('~/.gmane2/')
dl.downloadedStats()  # might take a while
print("made liststats")

lm = g.LoadMessages(dl.lists[0][0], basedir="~/.gmane2/")
print("loaded messages")
ds = g.ListDataStructures(lm)
print("made datastructures")
iN = g.InteractionNetwork(ds)
print("made interaction network")
nm = g.NetworkMeasures(iN)
print("network mesaures")

# Make PCA of degree, betweenness and clustering
# with in, out and total degree and strengths
# and with symmetry related measures
npca = g.NetworkPCA(nm)

# Make network partitioning
np = g.NetworkPartitioning(nm, 3, "g")
print("partitioned network")

# Plot PCA with partitions
npca = g.NetworkPCA(nm, np)
コード例 #2
0
PDIR="pickledir/"
NEs=[] # for evolutions of the networks

for lid in dl.downloaded_lists[:1]:
    label=labels[lid]
    NEs.append(pRead("{}neP{}.pickle".format(PDIR,label)))
    print(label+"{0:.2f} for PICKLE loading evolved PCA structures".format(T.time()-TT)); TT=T.time()
# NEs[0].network_measures[X] have E, N, degrees, etc and my be ok to make network partition
ne=NEs[0] # snapshots ordenados
nm=ne.networks_measures[-1]

# nao achei network partitionings no ne (binario de versao antiga da classe?)
# fazendo o partitionings

np=g.NetworkPartitioning(nm)
p.figure(figsize=(10.,3.))
p.subplots_adjust(left=0.08,bottom=0.18,right=0.99,top=0.87)


p.bar([i[0]-0.5 for i in np.bins],
        np.empirical_distribution,
        alpha=.7, label="empirical distribution")
#p.bar(n.log([i[0]-0.5 for i in np.bins]),
#      n.log(  np.empirical_distribution),
#        alpha=.7, label="empirical distribution")
centers=[i[0] for i in np.bins]
binomial_probs=[]
for i, bin_ in enumerate(np.bins):
    llimit=bin_[0]
    rlimit=bin_[1]
コード例 #3
0
dreload(g, exclude="pytz")

dl = g.DownloadGmaneData('~/.gmane2/')
dl.downloadedStats()  # might take a while
print("made liststats")

lm = g.LoadMessages(dl.lists[0][0], basedir="~/.gmane2/")
print("loaded messages")
ds = g.ListDataStructures(lm)
print("made datastructures")
iN = g.InteractionNetwork(ds)
print("made interaction network")
nm = g.NetworkMeasures(iN)
print("network mesaures")

np = g.NetworkPartitioning(nm)
print("partitioned network")
np2 = g.NetworkPartitioning(nm, 2)
print("partitioned network")
np3 = g.NetworkPartitioning(nm, 3)
print("partitioned network")

np_ = g.NetworkPartitioning(nm, 1, "g")
print("partitioned network")
np2_ = g.NetworkPartitioning(nm, 2, "g")
print("partitioned network")
np3_ = g.NetworkPartitioning(nm, 3, "g")
print("partitioned network")

ps = [np, np2, np3]  # partition by strength
pg = [np_, np2_, np3_]  # partition by degree
コード例 #4
0
ファイル: makeTextTables.py プロジェクト: ttm/gmaneLegacy
    print("{0:.2f} for statistics along time".format(T.time() - TT))
    TT = T.time()
    tss.append(ts)
    pDump(ts, "{}ts{}.pickle".format(PDIR, lid))

    iN = g.InteractionNetwork(ds)
    print("made interaction network")
    iNs.append(iN)
    pDump(iN, "{}iN{}.pickle".format(PDIR, lid))

    nm = g.NetworkMeasures(iN, exclude=["rich_club"])
    print("network mesaures")
    nms.append(nm)
    pDump(nm, "{}nm{}.pickle".format(PDIR, lid))

    np2_ = g.NetworkPartitioning(nm, 2, "g")
    print("partitioned network")
    nps.append(np2_)
    pDump(nm, "{}np{}.pickle".format(PDIR, lid))

data_ = []
count = 0
for lid in dl.lists[4:6]:
    lid = lid[0]
    ds = dss[count]
    np = nps[count]
    count += 1
    date1 = ds.messages[ds.message_ids[0]][2].isoformat().split("T")[0]
    date2 = ds.messages[ds.message_ids[-1]][2].isoformat().split("T")[0]
    N = ds.n_authors
    Ns = [len(i) for i in np.sectorialized_agents__]