本文整理汇总了Python中NeuralNetwork.NeuralNetwork.feedforward方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNetwork.feedforward方法的具体用法?Python NeuralNetwork.feedforward怎么用?Python NeuralNetwork.feedforward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeuralNetwork.NeuralNetwork
的用法示例。
在下文中一共展示了NeuralNetwork.feedforward方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import feedforward [as 别名]
def main():
data = np.array([[1.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0, 0.0]
])
result = np.array([[0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 1.0, 0.0]
])
Nn = NeuralNetwork([5, 5, 5])
print Nn.feedforward(np.array([[5], [5], [5], [5], [5]]))
# to do trainning function
print Nn.feedforward(np.array([[5], [5], [5], [5], [5]]))
示例2: NeuralNetwork
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import feedforward [as 别名]
evadidos = np.genfromtxt('dados_alunos_evadidos.csv', delimiter=',')
ativos = np.genfromtxt('dados_alunos_ativos.csv', delimiter=',')
alunos = np.concatenate((evadidos, ativos), axis=0)
np.random.shuffle(alunos);
x = np.zeros(shape=(0, 30))
y = np.zeros(shape=(0, 2))
for aluno in alunos:
y = np.concatenate((y, [[aluno[30], aluno[31]]]), axis=0);
aluno = np.delete(aluno, 31)
aluno = np.delete(aluno, 30)
x = np.concatenate((x, [aluno]), axis=0)
nn = NeuralNetwork(x, y)
# Treinamento da rede
for i in range(1000000):
nn.feedforward()
nn.backprop()
#print(nn.output)
# Teste da rede
x = np.array([
[0,1,0,0,1,0,0,0,0,1,1,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,0,0,0], # Aluno evadido
[1,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,0,0,0,1,0] # Aluno ativo
])
nn.input = x;
nn.feedforward()
print(nn.output)