git详细代码仓库:https://github.com/justDoForever/deep_learning (python 2.7)
理论分析: https://www.zybuluo.com/hanbingtao/note/476663
代码如下:
# coding:utf-8
# 全连接神经网络的实现
import random
from math import e
def sigmoid(output):
return 1 / (1 + pow(e,-output))
#结点类 负责记录和维护结点自身信息以及这个结点的上下游连接 实现输出值和误差项的计算
class Node(object):
#layer_index 层编号 node_index 结点编号
def __init__(self,layer_index,node_index):
self.layer_index = layer_index;
self.node_index = node_index
self.upstream = [];
self.downstream = [];
self.output = 0.0;
self.delta = 0.0;
#结点绑定连接
def append_upstream_connection(self,conn):
#增加一个到上游结点的连接
self.upstream.append(conn)
def append_downstream_connection(self,conn):
#增加一个到下游结点