Exemplo n.º 1
0
    'startX': "stationary"
})

fitinfo = rw.Fitinfo({
    'startGraph': "windowgraph_valid",
    'followtype': "avg",
    'record': False,
    'recorddir': "records/",
    'prune_limit': 100,
    'triangle_limit': 100,
    'other_limit': 100
})

toygraph = rw.Toygraphs({
    'graphtype': "steyvers",
    'numnodes': 50,
    'numlinks': 6
})

fh = open('priming_test.csv', 'w')

seed = 15

for td in toydata:
    print "numx: ", td.numx
    # generate data with priming and fit best graph
    g, a = rw.genG(toygraph, seed=seed)
    [Xs, irts, alter_graph] = rw.genX(g, td, seed=seed)
    bestgraph_priming, ll = rw.uinvite(Xs,
                                       td,
                                       toygraph.numnodes,
Exemplo n.º 2
0
fitinfo=rw.Fitinfo({
        'startGraph': "windowgraph_valid",
        'windowgraph_size': 2,
        'windowgraph_threshold': 2,
        'followtype': "avg", 
        'prior_samplesize': 10000,
        'recorddir': "records/",
        'directed': True,
        'prune_limit': np.inf,
        'triangle_limit': np.inf,
        'other_limit': np.inf})

toygraphs=rw.Toygraphs({
        'numgraphs': 1,
        'graphtype': "steyvers",
        'numnodes': 280,
        'numlinks': 6,
        'prob_rewire': .3})

irts=rw.Irts({
        'data': [],
        'irttype': "exgauss",
        'lambda': 0.721386887,
        'sigma': 6.58655566,
        'irt_weight': 0.95,
        'rcutoff': 20})

# USF prior
#usfnet, usfitems = rw.read_csv('./snet/USF_animal_subset.snet')
#priordict = rw.genGraphPrior([usfnet], [usfitems]) 
Exemplo n.º 3
0
import rw
import math

# double check number of nodes is correct
graph = rw.Toygraphs({
    'graphtype': "smallworld",
    'numnodes': 50,
    'numlinks': 4,
    'probRewire': .3
})

prior = rw.genSWPrior(
    graph)  # same vals used in generating test_case_prior.csv

outfile = open('swvals3.csv', 'w')

with open('test_case_prior2.csv', 'r') as fh:
    next(fh)  # skip header row
    for line in fh:
        line = line.split(',')

        tg = rw.hashToGraph(line[10])  # true graph
        nrw = rw.hashToGraph(line[14])  # naive random walk
        uinp = rw.hashToGraph(line[22])  # u-invite no prior
        uip = rw.hashToGraph(line[30])  # u-invite w/ prior
        numx = str(line[7])

        outfile.write(numx + ',')
        outfile.write(
            str(math.log(rw.evalSWPrior(rw.smallworld(tg), prior))) + ',')
        outfile.write(