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]
评论列表
文章目录