def buildNetwork(self): net = GRNetwork(self.nodes); c = np.random.random(len(self.nodes)); self.buildPaStore(); for index in range(len(self.nodes)): ntempDist = self.buildPaDistribution(index); pachoice = mysample(ntempDist, c[index], self.paStore[index]); net.initializeParent(self.nodes[index], pachoice); return net;
def buildNetwork(self): net = GRNetwork(self.nodes) c = np.random.random(len(self.nodes)) self.buildPaStore() for index in range(len(self.nodes)): ntempDist = self.buildPaDistribution(index) pachoice = mysample(ntempDist, c[index], self.paStore[index]) net.initializeParent(self.nodes[index], pachoice) return net
def buildNetwork2(gdict, paDict, logWeightMap): net = GRNetwork( list(gdict.values()) ); for k,v in gdict.items(): allPaSets = paDict[k]; dist1 = []; for paSet in allPaSets: hkey = buildHKey(v,paSet); dist1.append(logWeightMap[hkey]); dist2 = np.array(dist1); distribution = dist2/np.sum(dist2); initPa = mysample(distribution, np.random.random() , allPaSets); net.initializeParent(v, initPa); return net;
def buildNetwork(gdict,paDict, weightMap ): net = GRNetwork( list(gdict.values()) ); for k,v in gdict.items(): allPaSets = paDict[k]; distribution = []; for paSet in allPaSets: speciesId = v.getSpeciesId(); gid = v.getGeneId(); pasId = ':'.join([pa.getGeneId() for pa in paSet]); distribution.append(weightMap[buildKey(speciesId, gid, pasId)]); initPa = mysample(distribution, np.random.random() , allPaSets); net.initializeParent(v, initPa); return net;
def buildNetwork2(gdict, paDict, logWeightMap): net = GRNetwork(list(gdict.values())) for k, v in gdict.items(): allPaSets = paDict[k] dist1 = [] for paSet in allPaSets: hkey = buildHKey(v, paSet) dist1.append(logWeightMap[hkey]) dist2 = np.array(dist1) distribution = dist2 / np.sum(dist2) initPa = mysample(distribution, np.random.random(), allPaSets) net.initializeParent(v, initPa) return net
def buildNetwork(gdict, paDict, weightMap): net = GRNetwork(list(gdict.values())) for k, v in gdict.items(): allPaSets = paDict[k] distribution = [] for paSet in allPaSets: speciesId = v.getSpeciesId() gid = v.getGeneId() pasId = ':'.join([pa.getGeneId() for pa in paSet]) distribution.append(weightMap[buildKey(speciesId, gid, pasId)]) initPa = mysample(distribution, np.random.random(), allPaSets) net.initializeParent(v, initPa) return net