本文整理汇总了Python中network.Network.save方法的典型用法代码示例。如果您正苦于以下问题:Python Network.save方法的具体用法?Python Network.save怎么用?Python Network.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network.Network
的用法示例。
在下文中一共展示了Network.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: trainnetwork
# 需要导入模块: from network import Network [as 别名]
# 或者: from network.Network import save [as 别名]
def trainnetwork():
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
network= Network([1200,30,10])
network.SGD(training_data,30,10,.5,test_data=test_data)
network.save("network.txt")
示例2: range
# 需要导入模块: from network import Network [as 别名]
# 或者: from network.Network import save [as 别名]
three = [1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1]
# Set some quick properties for the upcoming training session
ITERATIONS = 1000 # Number of iterations per training session
LEARN_RATE = 0.03 # The rate the network learns on each iteration
THRESHOLD = 0.001 # If this precision is reached, the training session is instantly complete
# Perform a quick training session
for i in range(0, ITERATIONS, 1):
error = 0
# Example Data Inputs Outputs Learn Rate
error += network.train(zero, [0, 0], LEARN_RATE)
error += network.train(one, [0, 1], LEARN_RATE)
error += network.train(two, [1, 0], LEARN_RATE)
error += network.train(three, [1, 1], LEARN_RATE)
# Check the error
if error < THRESHOLD:
break
# Process the outputs
outputs = network.process([0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1])
# Save the neural network to a file
Network.save("test_binary.json", network)
# Print the decimal equivalent of the network's output (Expected: ~2)
print(sum([(2 ** i) * outputs[-i - 1] for i in range(0, len(outputs), 1)]))