2002.py 文件源码

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

项目:HumanLearning 作者: dgtgrade 项目源码 文件源码
def ff(self,x):

        n_nodes = self.n_nodes
        assert len(x) == n_nodes[0]

        self.nas[0:n_nodes[0]] = x # input node_a's

        # pl_ : of previous (left) layer
        pl_nas = np.append([1.0],self.nas[0:n_nodes[0]])
        for l in range(1,len(n_nodes)):

            thsM = self.__get_thsM(l-1)
            nzs = self.__get_nzs(l)
            nas = self.__get_nas(l)

            nzs[:] = np.dot(thsM,pl_nas)

            # ??? ??? cross-entropy? ???? ??? 
            # ??? ???? sigmoid? ?????
            # ??? ??? quadric? ?????
            # ??? ???? activate ?? ??? ?? ??? ?
            if (l<len(n_nodes)-1):
                nas[:] = self.activate(nzs)
            else:
                nas[:] = self.__sigmoid(nzs)

            # ???? ????? traing ?? testing ?? ??
            # ????? ???.
            if (self.doDropout):
                dropout = self.__get_dropout(l)
                nas[:] = nas*np.invert(dropout)
            else:
                nas[:] = nas*(1.0-self.DORATE)

            pl_nas = nas
            pl_nas = np.append([1.0],pl_nas) # add bias node
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号