@scope.define
def idxs_prod(full_idxs, idxs_by_label, llik_by_label):
 assert (len(set(full_idxs)) == len(full_idxs))
 full_idxs = list(full_idxs)
 rval = np.zeros(len(full_idxs))
 pos_of_tid = dict(list(zip(full_idxs, list(range(len(full_idxs))))))
 assert (set(idxs_by_label.keys()) == set(llik_by_label.keys()))
 for nid in idxs_by_label:
  idxs = idxs_by_label[nid]
  llik = llik_by_label[nid]
  assert np.all((np.asarray(idxs) > 1))
  assert (len(set(idxs)) == len(idxs))
  assert (len(idxs) == len(llik))
  for (ii, ll) in zip(idxs, llik):
   rval[pos_of_tid[ii]] += ll
 return rval

@ scope . define def idxs_prod ( full_idxs , idxs_by_label , llik_by_label ) : assert ( len ( set ( full_idxs ) ) == len ( full_idxs ) ) full_idxs = list ( full_idxs ) rval = np . zeros ( len ( full_idxs ) ) pos_of_tid = dict ( list ( zip ( full_idxs , list ( range ( len ( full_idxs ) ) ) ) ) ) assert ( set ( idxs_by_label . keys ( ) ) == set ( llik_by_label . keys ( ) ) ) for nid in idxs_by_label : idxs = idxs_by_label [ nid ] llik = llik_by_label [ nid ] assert np . all ( ( np . asarray ( idxs ) > 1 ) ) assert ( len ( set ( idxs ) ) == len ( idxs ) ) assert ( len ( idxs ) == len ( llik ) ) for ( ii , ll ) in zip ( idxs , llik ) : rval [ pos_of_tid [ ii ] ] += ll return rval
add all of the log-likelihoods together by id .