本文整理汇总了Python中NeuralNetwork.NeuralNetwork.back_propagation方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNetwork.back_propagation方法的具体用法?Python NeuralNetwork.back_propagation怎么用?Python NeuralNetwork.back_propagation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeuralNetwork.NeuralNetwork
的用法示例。
在下文中一共展示了NeuralNetwork.back_propagation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_iris_comparison
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import back_propagation [as 别名]
def run_iris_comparison(num=25):
""" Compare a few different test and
training configurations
"""
print("Running neural network {} times each for three different sets of training and testing files".format(num))
test_files = ['iris_tes.txt', 'iris_tes50.txt',\
'iris_tes30.txt']
train_files = ['iris_tra.txt', 'iris_tra100.txt',\
'iris_tra120.txt']
for i in range(0, len(test_files)):
print("trainfile = {} testfile = {}".format(train_files[i], test_files[i]))
config_obj = openJsonConfig('conf/annconfig_iris.json')
summary = {}
for i in range(0, len(test_files)):
config_obj['testing_file'] = test_files[i]
config_obj['training_file'] = train_files[i]
config_obj['plot_error'] = False
config_obj['test'] = False
crates = []
for j in range(0, num):
nn = NeuralNetwork(config_obj)
nn.back_propagation()
cmat, crate, cout = nn.classification_test(nn.testing_data, nn.weights_best)
crates.append(crate)
summary[config_obj['testing_file']] =\
nn_stats(np.array(crates))
print print_stat_summary(summary)
示例2: run_reg_nn
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import back_propagation [as 别名]
def run_reg_nn():
nn = NeuralNetwork('fake_config.json')
nn.back_propagation()
#plot_error(nn)
return nn
示例3: test_nn
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import back_propagation [as 别名]
def test_nn(config):
nn = NeuralNetwork(config)
nn.back_propagation()
cmat, crate, cout = nn.classification_test(nn.testing_data, nn.weights_best)
print cmat
print crate
示例4: run_nn
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import back_propagation [as 别名]
def run_nn(config):
nn = NeuralNetwork(config)
nn.back_propagation()
示例5: run_xor
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import back_propagation [as 别名]
def run_xor():
nn = NeuralNetwork('xor.json')
nn.back_propagation()
plot_error(nn)