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