当前位置: 首页>>代码示例>>Python>>正文


Python Network.save方法代码示例

本文整理汇总了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")
开发者ID:shivamgargsya,项目名称:Intelligent_Car,代码行数:9,代码来源:trainnetwork.py

示例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)]))
开发者ID:XxZ350xX,项目名称:Neural-Network,代码行数:31,代码来源:test_binary.py


注:本文中的network.Network.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。