def _calculateError(self, recordNum, bucketIdxList):
error = dict()<EOL>targetDist = numpy.zeros(self._maxBucketIdx + <NUM_LIT:1>)<EOL>numCategories = len(bucketIdxList)<EOL>for bucketIdx in bucketIdxList:<EOL><INDENT>targetDist[bucketIdx] = <NUM_LIT:1.0>/numCategories<EOL><DEDENT>for (learnRecordNum, learnPatternNZ) in self._patternNZHistory:<EOL><INDENT>nSteps = recordNum - learnRecordNum<EOL>if nSteps in self.steps:<EOL><INDENT>predictDist = self.inferSingleStep(learnPatternNZ,<EOL>self._weightMatrix[nSteps])<EOL>error[nSteps] = targetDist - predictDist<EOL><DEDENT><DEDENT>return error<EOL>
Calculate error signal

:param bucketIdxList: list of encoder buckets

:return: dict containing error. The key is the number of steps
         The value is a numpy array of error at the output layer