

def _calcDerivs(self, seq):
    'Calculate error function and backpropagate output errors to yield\n        the gradient.'
    self.module.reset()
    for sample in seq:
        self.module.activate(sample[0])
    error = 0
    ponderation = 0.0
    for (offset, sample) in reversed(list(enumerate(seq))):
        target = sample[1]
        outerr = (target - self.module.outputbuffer[offset])
        if (len(sample) > 2):
            importance = sample[2]
            error += (0.5 * dot(importance, (outerr ** 2)))
            ponderation += sum(importance)
            self.module.backActivate((outerr * offset))
        else:
            error += (0.5 * sum((outerr ** 2)))
            ponderation += len(target)
            str(outerr)
            self.module.backActivate(outerr)
    return (error, ponderation)

dataset/ETHPy150Open pybrain/pybrain/pybrain/supervised/trainers/backprop.py BackpropTrainer._calcDerivs/VarMisuse@144/191 `importance`->`offset`