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


Python FeedForwardNetwork.addRecurrentConnection方法代码示例

本文整理汇总了Python中pybrain.structure.FeedForwardNetwork.addRecurrentConnection方法的典型用法代码示例。如果您正苦于以下问题:Python FeedForwardNetwork.addRecurrentConnection方法的具体用法?Python FeedForwardNetwork.addRecurrentConnection怎么用?Python FeedForwardNetwork.addRecurrentConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pybrain.structure.FeedForwardNetwork的用法示例。


在下文中一共展示了FeedForwardNetwork.addRecurrentConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LinearLayer

# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import addRecurrentConnection [as 别名]
print in_to_hidden.params
print hidden_to_out.params
print n.params
print n.activate([1, 2])

# Naming your NN
print LinearLayer(2).name
LinearLayer(2, name='foo')
print LinearLayer(2).name

# Using Recurrent NN
n = RecurrentNetwork()

n.addInputModule(LinearLayer(2, name='in'))
n.addModule(SigmoidLayer(3, name='hidden'))
n.addOutputModule(LinearLayer(1, name='out'))
n.addConnection(FullConnection(n['in'], n['hidden'], name='c1'))
n.addConnection(FullConnection(n['hidden'], n['out'], name='c2'))

# Looks back in time one timestep
n.addRecurrentConnection(FullConnection(n['hidden'], n['hidden'], name='c3'))

# Using RNN, every steps gets different value of Neron
n.sortModules()
print n.activate([2, 2])
print n.activate([2, 2])
print n.activate([2, 2])
n.reset()  # Clear n and Reset it
print n.activate([2, 2])
print n.activate([2, 2])
开发者ID:dovetion,项目名称:MCM-Algorithm-Note,代码行数:32,代码来源:pybrainIntro.py

示例2: RecurrentNetwork

# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import addRecurrentConnection [as 别名]
# print n.activate([1,2])

# print weights
# print in_to_hidden.params

""" -- RECURRENT NETWORK -- """
from pybrain.structure import RecurrentNetwork

n = RecurrentNetwork()

n.addInputModule(LinearLayer(2, name="in"))
n.addModule(SigmoidLayer(3, name="hidden"))
n.addOutputModule(LinearLayer(1, name="out"))
n.addConnection(FullConnection(n["in"], n["hidden"], name="c1"))
n.addConnection(FullConnection(n["hidden"], n["out"], name="c2"))

n.addRecurrentConnection(FullConnection(n["hidden"], n["hidden"], name="c3"))

n.sortModules()

# the result is different every time
# print n.activate((2,2))
# print n.activate((2,2))
# print n.activate((2,2))

# goes back to its original initialization state
n.reset()
# print n.activate((2,2))
# print n.activate((2,2))
# print n.activate((2,2))
开发者ID:aliasch,项目名称:programming,代码行数:32,代码来源:intro_tutorial.py


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