

def testOnData(self, dataset=None, verbose=False):
    'Compute the MSE of the module performance on the given dataset.\n\n        If no dataset is supplied, the one passed upon Trainer initialization is\n        used.'
    if (dataset == None):
        dataset = self.ds
    dataset.reset()
    if verbose:
        print('\nTesting on data:')
    errors = []
    importances = []
    ponderatedErrors = []
    for seq in dataset._provideSequences():
        self.module.reset()
        (e, i) = self._evaluateSequence(self.module.activate, seq, verbose)
        importances.append(i)
        errors.append(e)
        ponderatedErrors.append((e / i))
    if verbose:
        print(('All errors:', ponderatedErrors))
    assert (sum(importances) > 0)
    avgErr = (sum(errors) / sum(importances))
    if verbose:
        print(('Average error:', avgErr))
        print(('Max error:', max(ponderatedErrors), 'Median error:', sorted(ponderatedErrors)[(len(errors) // 2)]))
    return avgErr

dataset/ETHPy150Open pybrain/pybrain/pybrain/supervised/trainers/backprop.py BackpropTrainer.testOnData/VarMisuse@93/170 `dataset`->`self`