本文整理汇总了Python中pybrain.structure.FeedForwardNetwork.convertToFastNetwork方法的典型用法代码示例。如果您正苦于以下问题:Python FeedForwardNetwork.convertToFastNetwork方法的具体用法?Python FeedForwardNetwork.convertToFastNetwork怎么用?Python FeedForwardNetwork.convertToFastNetwork使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybrain.structure.FeedForwardNetwork
的用法示例。
在下文中一共展示了FeedForwardNetwork.convertToFastNetwork方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: trained_cat_dog_ANN
# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import convertToFastNetwork [as 别名]
def trained_cat_dog_ANN():
n = FeedForwardNetwork()
d = get_cat_dog_trainset()
input_size = d.getDimension('input')
n.addInputModule(LinearLayer(input_size, name='in'))
n.addModule(SigmoidLayer(input_size+1500, name='hidden'))
n.addOutputModule(LinearLayer(2, name='out'))
n.addConnection(FullConnection(n['in'], n['hidden'], name='c1'))
n.addConnection(FullConnection(n['hidden'], n['out'], name='c2'))
n.sortModules()
n.convertToFastNetwork()
print 'successful converted to fast network'
t = BackpropTrainer(n, d, learningrate=0.0001)#, momentum=0.75)
count = 0
while True:
globErr = t.train()
print globErr
count += 1
if globErr < 0.01:
break
if count == 30:
break
exportCatDogANN(n)
return n
示例2: testMdlstm
# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import convertToFastNetwork [as 别名]
def testMdlstm(self):
net = FeedForwardNetwork()
net.addInputModule(LinearLayer(1, name='in'))
net.addModule(MDLSTMLayer(1, 1, name='hidden'))
net.addOutputModule(LinearLayer(1, name='out'))
net.addConnection(FullConnection(net['in'], net['hidden']))
net.addConnection(FullConnection(net['hidden'], net['out']))
net.sortModules()
self.equivalence_feed_forward(net, net.convertToFastNetwork())
示例3: __init__
# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import convertToFastNetwork [as 别名]
def __init__(self, index, name, params):
self.name = name
self.index = index
self.liste = []#ClassificationDataSet(17, 1, nb_classes=4)
self.status_good = True
self.number_of_moves = 0
self.number_of_sound_moves = 0
n = FeedForwardNetwork()
self.inLayer = LinearLayer(17)
self.hiddenLayer = SigmoidLayer(5)
self.outLayer = LinearLayer(4)
n.addInputModule(self.inLayer)
n.addModule(self.hiddenLayer)
n.addOutputModule(self.outLayer)
from pybrain.structure import FullConnection
in_to_hidden = FullConnection(self.inLayer, self.hiddenLayer)
hidden_to_out = FullConnection(self.hiddenLayer, self.outLayer)
n.addConnection(in_to_hidden)
n.addConnection(hidden_to_out)
n.sortModules()
for j, i in enumerate(params[0]):
n.connections[self.hiddenLayer][0].params[j] = i
for j, i in enumerate(params[1]):
n.connections[self.inLayer][0].params[j] = i
n.convertToFastNetwork()
self.n = n
self.n.convertToFastNetwork()
示例4: __init__
# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import convertToFastNetwork [as 别名]
def __init__(self, index, name, params):
self.name = name
self.index = index
self.status_good = True
n = FeedForwardNetwork()
self.inLayer = LinearLayer(17)
self.hiddenLayer = SigmoidLayer(5)
self.outLayer = LinearLayer(4)
n.addInputModule(self.inLayer)
n.addModule(self.hiddenLayer)
n.addOutputModule(self.outLayer)
from pybrain.structure import FullConnection
in_to_hidden = FullConnection(self.inLayer, self.hiddenLayer)
hidden_to_out = FullConnection(self.hiddenLayer, self.outLayer)
n.addConnection(in_to_hidden)
n.addConnection(hidden_to_out)
n.sortModules()
for j, i in enumerate(params[0]):
n.connections[self.hiddenLayer][0].params[j] = i
for j, i in enumerate(params[1]):
n.connections[self.inLayer][0].params[j] = i
n.convertToFastNetwork()
self.n = n
#
self.n.convertToFastNetwork()
示例5: __init__
# 需要导入模块: from pybrain.structure import FeedForwardNetwork [as 别名]
# 或者: from pybrain.structure.FeedForwardNetwork import convertToFastNetwork [as 别名]
def __init__(self, index, name, param):
self.name = name
self.index = index
self.liste = []#ClassificationDataSet(17, 1, nb_classes=4)
self.status_good = True
self.number_of_moves = 0
self.number_of_sound_moves = 0
n = FeedForwardNetwork()
# self.inLayer = LinearLayer(17)
# self.hiddenLayer = SigmoidLayer(5)
# self.outLayer = LinearLayer(4)
#
#
# n.addInputModule(self.inLayer)
# n.addModule(self.hiddenLayer)
# n.addOutputModule(self.outLayer)
self.inLayer = LinearLayer(17)
self.hiddenLayer1 = SigmoidLayer(15)
self.hiddenLayer2 = SigmoidLayer(15)
self.hiddenLayer3 = SigmoidLayer(15)
self.hiddenLayer4 = SigmoidLayer(15)
self.hiddenLayer5 = SigmoidLayer(15)
self.hiddenLayer6 = SigmoidLayer(15)
self.outLayer = LinearLayer(4)
n.addInputModule(self.inLayer)
n.addModule(self.hiddenLayer1)
n.addModule(self.hiddenLayer2)
n.addModule(self.hiddenLayer3)
n.addModule(self.hiddenLayer4)
n.addModule(self.hiddenLayer5)
n.addModule(self.hiddenLayer6)
n.addOutputModule(self.outLayer)
from pybrain.structure import FullConnection
in_to_hidden = FullConnection(self.inLayer, self.hiddenLayer1)
hidden_to_hidden1 = FullConnection(self.hiddenLayer1, self.hiddenLayer2)
hidden_to_hidden2 = FullConnection(self.hiddenLayer2, self.hiddenLayer3)
hidden_to_hidden3 = FullConnection(self.hiddenLayer3, self.hiddenLayer4)
hidden_to_hidden4 = FullConnection(self.hiddenLayer4, self.hiddenLayer5)
hidden_to_hidden5 = FullConnection(self.hiddenLayer5, self.hiddenLayer6)
hidden_to_out = FullConnection(self.hiddenLayer6, self.outLayer)
n.addConnection(in_to_hidden)
n.addConnection(hidden_to_hidden1)
n.addConnection(hidden_to_hidden2)
n.addConnection(hidden_to_hidden3)
n.addConnection(hidden_to_hidden4)
n.addConnection(hidden_to_hidden5)
n.addConnection(hidden_to_out)
# in_to_hidden = FullConnection(self.inLayer, self.hiddenLayer)
# hidden_to_out = FullConnection(self.hiddenLayer, self.outLayer)
# n.addConnection(in_to_hidden)
# n.addConnection(hidden_to_out)
n.sortModules()
print len(n.connections[self.inLayer][0].params)
print len(n.connections[self.hiddenLayer1][0].params )
print len(n.connections[self.hiddenLayer2][0].params)
print len(n.connections[self.hiddenLayer3][0].params)
print len(n.connections[self.hiddenLayer4][0].params)
print len(n.connections[self.hiddenLayer5][0].params)
print len(n.connections[self.hiddenLayer6][0].params)
for j, i in enumerate(param[0]):
n.connections[self.inLayer][0].params[j] = i
for j, i in enumerate(param[1]):
n.connections[self.hiddenLayer1][0].params[j] = i
for j, i in enumerate(param[2]):
n.connections[self.hiddenLayer2][0].params[j] = i
for j, i in enumerate(param[3]):
n.connections[self.hiddenLayer3][0].params[j] = i
for j, i in enumerate(param[4]):
n.connections[self.hiddenLayer4][0].params[j] = i
for j, i in enumerate(param[5]):
n.connections[self.hiddenLayer5][0].params[j] = i
for j, i in enumerate(param[6]):
n.connections[self.hiddenLayer6][0].params[j] = i
n.convertToFastNetwork()
self.n = n
self.n.convertToFastNetwork()