本文整理汇总了Python中pybrain.datasets.SupervisedDataSet.append方法的典型用法代码示例。如果您正苦于以下问题:Python SupervisedDataSet.append方法的具体用法?Python SupervisedDataSet.append怎么用?Python SupervisedDataSet.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybrain.datasets.SupervisedDataSet
的用法示例。
在下文中一共展示了SupervisedDataSet.append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import append [as 别名]
class MoveBrain:
def __init__(self):
self.n = RecurrentNetwork()
inLayer = LinearLayer(8)
hiddenLayer = SigmoidLayer(4)
self.numInputs = 8
outLayer = LinearLayer(4)
self.n.addInputModule(inLayer)
self.n.addModule(hiddenLayer)
self.n.addOutputModule(outLayer)
in_to_hidden = FullConnection(inLayer, hiddenLayer)
hidden_to_out = FullConnection(hiddenLayer, outLayer)
self.n.addConnection(in_to_hidden)
self.n.addConnection(hidden_to_out)
self.n.sortModules()
self.ds = SupervisedDataSet(8, 4)
self.trainer = BackpropTrainer(self.n, self.ds)
def run(inputs):
if inputs.size() == self.numInputs:
self.n.activate(inputs)
else:
print "num of inputs do not match"
def addRule(self,rule):
self.ds.append(rule)
def saveNetwork(self):
fileObject = open('networks/avoidandfindv1', 'w')
pickle.dump(self.n, fileObject)
fileObject.close()