示例#1
0
trim=1

theta=.5                # probability of hiding node when generating z from x (rho function)
numgraphs=100
maxlen=20               # no closed form, number of times to sum over
jeff = .5
numperseed=50
edgestotweak=[1,1,1,2,3,4,5,6,7,8,9,10]
numkeep=3
beta=1             # for gamma distribution when generating IRTs from hidden nodes

# record start time

# toy data
g,a=rw.genG(numnodes,numlinks,probRewire) 
Xs=[rw.genX(g) for i in range(numx)]
[Xs,g,a,numnodes]=rw.trimX(trim,Xs,g)
expected_irts=rw.expectedIRT(Xs,a,numnodes, beta)

subj="S103"
category="animals"
starttime=str(datetime.now())

Xs, items, expected_irts, numnodes=readX(subj,category)

# gen candidate graphs
graphs=rw.genGraphs(numgraphs,theta,Xs,numnodes)
graphs.append(rw.noHidden(Xs,numnodes)) # probably best starting graph
#allnodes=[(i,j) for i in range(len(a)) for j in range(len(a)) if (i!=j) and (i>j)]

max_converge=25
示例#2
0
bestgraph_irts=[]
bestgraph_noirts=[]

# WRITE DATA
outfile='sim_resultsx.csv'

f=open(outfile,'a', 0) # write/append to file with no buffering

for seed_param in range(100):
    for irt_param in range(2):
        graph_seed=seed_param
        x_seed=seed_param

        # toy data
        g,a=rw.genG(numnodes,numlinks,probRewire,seed=graph_seed)
        [Xs,irts]=zip(*[rw.genX(g, seed=x_seed+i,use_irts=1) for i in range(numx)])
        Xs=list(Xs)
        irts=list(irts)
        [Xs,alter_graph]=rw.trimX(trim,Xs,g)
        
        if irt_param:
            irts=rw.stepsToIRT(irts, beta, offset)

        starttime=datetime.now()

        # gen candidate graphs
        graphs=rw.genGraphs(numgraphs,theta,Xs,numnodes)
        graphs.append(rw.noHidden(Xs,numnodes)) # probably best starting graph

        converge=0
        oldbestval=0