當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。