def update_lam_z(self, main_rdd, cinfo,iStar,Gamma):
ainv = cinfo
def update(t, ainv):
p=[]
[tpl, gen] = t
for ((tx,lam,z),index) in tpl:
znew=0.0
if gen.random()<self.ptr:
znew=-(np.matrix(tx)*ainv*np.matrix(tx).T)[0,0]
else:
znew= 0.0
zupdtd = (1.0-self.beta)*z + self.beta*znew
if index != iStar:
lamupdt = (1-Gamma)*lam
else:
lamupdt = (1-Gamma)*lam +lam
p.append(((tx,lamupdt,zupdtd),index))
out = [p,gen]
return out
main_rdd = main_rdd.mapValues(lambda t:update(t,ainv)).persist()
return main_rdd
评论列表
文章目录