本文整理汇总了Python中pybrain.datasets.SupervisedDataSet.next方法的典型用法代码示例。如果您正苦于以下问题:Python SupervisedDataSet.next方法的具体用法?Python SupervisedDataSet.next怎么用?Python SupervisedDataSet.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybrain.datasets.SupervisedDataSet
的用法示例。
在下文中一共展示了SupervisedDataSet.next方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import next [as 别名]
class LearningData:
def __init__(self, inputSize, outputSize):
self._inputSize = inputSize
self._outputSize = outputSize
self._dataset = SupervisedDataSet(inputSize, outputSize)
def addLetter(self, letterMatrix, morseCode):
letterTable = self.convertToTable(letterMatrix)
self._checkForSizeError(len(letterTable), len(morseCode))
self._dataset.addSample(letterTable, morseCode)
def _checkForSizeError(self, letterTableLen, morseCodeLen):
if letterTableLen != self._inputSize:
raise RuntimeError("Size of letter different than size declared. Expect %d actual %d" % (self._inputSize, letterTableLen))
if morseCodeLen != self._outputSize:
raise RuntimeError("Size of morse code different than size declared. Expect %d actual %d" % (self.outputSize, morseCodeLen))
def getInputSize(self):
return self._inputSize
def getOutputSize(self):
return self._outputSize
def getDataSet(self):
return self._dataset
@staticmethod
def convertToTable(letterMatrix):
letterTable = []
for row in letterMatrix:
letterTable.extend(row)
return letterTable
@staticmethod
def getLetterMatrixSize(letterMatrix):
count = 0
for row in letterMatrix:
count += len(row)
return count
def __iter__(self):
return self._dataset.__iter__()
def next(self):
return self._dataset.next()