def random_walks_by_chunk_get_score(mym1,mym2,tmin,tmax,nonzero_total,chunksize):
scores=[]
hdf5_names={}
n=mym1.shape[0]
m1_t=mym1.transpose()
m2_t=mym2.transpose()
#write the ms into hdf5s
#todo: make name more specific
#print 'filling hdf5 '+strftime("%c")
hdf5_names[1]='hdf5s'
fill_hdf5_with_sparse_by_chunk(mym1,mym2,hdf5_names[1],chunksize)
for t in range(1,(tmax+1)):
if t!=1:
hdf5_names[t]='hdf5s_'+str(t)
#t=1, t=(t-1) and the new t=t that we want to compute
multiply_by_chunk(hdf5_names[1],hdf5_names[t-1],hdf5_names[t],chunksize)
if t>=tmin:
scores.append(1.0*abs_diff_by_chunk(hdf5_names[t],'m1','m2',chunksize)/nonzero_total)
print 'done '+str(t)+' '+strftime("%c")
return scores
评论列表
文章目录