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


Python FeedForwardNetwork.randomize方法代码示例

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


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

示例1: buildXor

# 需要导入模块: from pybrain.structure.networks.feedforward import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.networks.feedforward.FeedForwardNetwork import randomize [as 别名]
 def buildXor(self):
     self.params['dataset'] = 'XOR'
     d = ClassificationDataSet(2)
     d.addSample([0., 0.], [0.])
     d.addSample([0., 1.], [1.])
     d.addSample([1., 0.], [1.])
     d.addSample([1., 1.], [0.])
     d.setField('class', [[0.], [1.], [1.], [0.]])
     self.trn_data = d
     self.tst_data = d
     global trn_data
     trn_data = self.trn_data
     nn = FeedForwardNetwork()
     inLayer = TanhLayer(2, name='in')
     hiddenLayer = TanhLayer(3, name='hidden0')
     outLayer = ThresholdLayer(1, name='out')
     nn.addInputModule(inLayer)
     nn.addModule(hiddenLayer)
     nn.addOutputModule(outLayer)
     in_to_hidden = FullConnection(inLayer, hiddenLayer)
     hidden_to_out = FullConnection(hiddenLayer, outLayer)
     nn.addConnection(in_to_hidden)
     nn.addConnection(hidden_to_out)
     nn.sortModules()
     nn.randomize()
     self.net_settings = str(nn.connections)
     self.nn = nn
开发者ID:mfbx9da4,项目名称:neuron-astrocyte-networks,代码行数:29,代码来源:pybrain_ga.py

示例2: buildIris

# 需要导入模块: from pybrain.structure.networks.feedforward import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.networks.feedforward.FeedForwardNetwork import randomize [as 别名]
 def buildIris(self):
     self.params['dataset'] = 'iris'
     self.trn_data, self.tst_data = pybrainData(0.5)
     global trn_data
     trn_data = self.trn_data
     nn = FeedForwardNetwork()
     inLayer = TanhLayer(4, name='in')
     hiddenLayer = TanhLayer(6, name='hidden0')
     outLayer = ThresholdLayer(3, name='out')
     nn.addInputModule(inLayer)
     nn.addModule(hiddenLayer)
     nn.addOutputModule(outLayer)
     in_to_hidden = FullConnection(inLayer, hiddenLayer)
     hidden_to_out = FullConnection(hiddenLayer, outLayer)
     nn.addConnection(in_to_hidden)
     nn.addConnection(hidden_to_out)
     nn.sortModules()
     nn.randomize()
     self.net_settings = str(nn.connections)
     self.nn = nn
开发者ID:mfbx9da4,项目名称:neuron-astrocyte-networks,代码行数:22,代码来源:pybrain_ga.py

示例3: buildParity

# 需要导入模块: from pybrain.structure.networks.feedforward import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.networks.feedforward.FeedForwardNetwork import randomize [as 别名]
 def buildParity(self):
     self.params['dataset'] = 'parity'
     self.trn_data = ParityDataSet(nsamples=75)
     self.trn_data.setField('class', self.trn_data['target'])
     self.tst_data = ParityDataSet(nsamples=75)
     global trn_data
     trn_data = self.trn_data
     nn = FeedForwardNetwork()
     inLayer = TanhLayer(4, name='in')
     hiddenLayer = TanhLayer(6, name='hidden0')
     outLayer = ThresholdLayer(1, name='out')
     nn.addInputModule(inLayer)
     nn.addModule(hiddenLayer)
     nn.addOutputModule(outLayer)
     in_to_hidden = FullConnection(inLayer, hiddenLayer)
     hidden_to_out = FullConnection(hiddenLayer, outLayer)
     nn.addConnection(in_to_hidden)
     nn.addConnection(hidden_to_out)
     nn.sortModules()
     nn.randomize()
     self.net_settings = str(nn.connections)
     self.nn = nn
开发者ID:mfbx9da4,项目名称:neuron-astrocyte-networks,代码行数:24,代码来源:pybrain_ga.py


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