def __init__(self, metricSpec):
<EOL>self.id = None<EOL>self.verbosity = <NUM_LIT:0><EOL>self.window = -<NUM_LIT:1><EOL>self.history = None<EOL>self.accumulatedError = <NUM_LIT:0><EOL>self.aggregateError = None<EOL>self.steps = <NUM_LIT:0><EOL>self.spec = metricSpec<EOL>self.disabled = False<EOL>self._predictionSteps = [<NUM_LIT:0>]<EOL>self._groundTruthHistory = deque([])<EOL>self._subErrorMetrics = None<EOL>self._maxRecords = None<EOL>if metricSpec is not None and metricSpec.params is not None:<EOL><INDENT>self.id = metricSpec.params.get('<STR_LIT:id>', None)<EOL>self._predictionSteps = metricSpec.params.get('<STR_LIT>', [<NUM_LIT:0>])<EOL>if not hasattr(self._predictionSteps, '<STR_LIT>'):<EOL><INDENT>self._predictionSteps = [self._predictionSteps]<EOL><DEDENT>self.verbosity = metricSpec.params.get('<STR_LIT>', <NUM_LIT:0>)<EOL>self._maxRecords = metricSpec.params.get('<STR_LIT>', None)<EOL>if '<STR_LIT>' in metricSpec.params:<EOL><INDENT>assert metricSpec.params['<STR_LIT>'] >= <NUM_LIT:1><EOL>self.history = deque([])<EOL>self.window = metricSpec.params['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in metricSpec.params:<EOL><INDENT>self._subErrorMetrics = []<EOL>for step in self._predictionSteps:<EOL><INDENT>subSpec = copy.deepcopy(metricSpec)<EOL>subSpec.params.pop('<STR_LIT>', None)<EOL>subSpec.params.pop('<STR_LIT>')<EOL>subSpec.metric = metricSpec.params['<STR_LIT>']<EOL>self._subErrorMetrics.append(getModule(subSpec))<EOL><DEDENT><DEDENT><DEDENT>
Initialize this metric

        If the params contains the key 'errorMetric', then that is the name of
        another metric to which we will pass a modified groundTruth and prediction
        to from our addInstance() method. For example, we may compute a moving mean
        on the groundTruth and then pass that to the AbsoluteAveError metric