modularDistFW.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:FrankWolfe 作者: neu-spiral 项目源码 文件源码
def  gen_comm_info(self,main_rdd):
        def cominfo(tpl):
            p=[]
            for ((tx,lam),index) in tpl:
                p.append(np.matrix(tx).T*lam)
            return p    
        def findDim(tpl):
            for ((tx,lam),index) in tpl:
                d = len(tx)
            return d
        d = main_rdd.mapValues(findDim).values().reduce(lambda x,y:x)
        c=main_rdd.flatMapValues(cominfo).map(lambda (key,value):value).reduce(lambda x,y:x+y)
        V=matrix(0.0,(d,1))
        for j in range(d):
            V[j]=math.exp(-self.C*self.r[j]*c[j,0])    
        return d,V
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号