mlbp_nn.py 文件源码

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

项目:ML_algorithm 作者: luoshao23 项目源码 文件源码
def init_param(self, nodes_list):
        if self.activation == 'logistic':
            init_bound = lambda inb, outb: np.sqrt(2. / (inb + outb))
        else:
            init_bound = lambda inb, outb: np.sqrt(6. / (inb + outb))

        self.ww = [self._random_state.uniform(-init_bound(nodes_list[i], nodes_list[i + 1]), init_bound(nodes_list[i], nodes_list[i + 1]), (nodes_list[i], nodes_list[i + 1]))
                   for i in xrange(self.layers_ - 1)]

        self.th = [self._random_state.uniform(-init_bound(nodes_list[i], nodes_list[i + 1]), init_bound(nodes_list[i], nodes_list[i + 1]), (nodes_list[i + 1],))
                   for i in xrange(self.layers_ - 1)]

        self.dww = [np.empty_like(w) for w in self.ww]

        self.dww_last = [np.empty_like(w) for w in self.ww]

        self.dth = [np.empty_like(th) for th in self.th]

        self.z = [np.empty_like(th) for th in self.th]

        self.a = [np.empty_like(th) for th in self.th]

        self.ro = [np.empty_like(th) for th in self.th]

        self.delta = [np.empty_like(th) for th in self.th]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号