def encode(self, inputRow):
<EOL>result = dict(zip(self._fieldNames, inputRow))<EOL>if self._categoryFieldIndex is not None:<EOL><INDENT>if isinstance(inputRow[self._categoryFieldIndex], int):<EOL><INDENT>result['<STR_LIT>'] = [inputRow[self._categoryFieldIndex]]<EOL><DEDENT>else:<EOL><INDENT>result['<STR_LIT>'] = (inputRow[self._categoryFieldIndex]<EOL>if inputRow[self._categoryFieldIndex]<EOL>else [None])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result['<STR_LIT>'] = [None]<EOL><DEDENT>if self._resetFieldIndex is not None:<EOL><INDENT>result['<STR_LIT>'] = int(bool(inputRow[self._resetFieldIndex]))<EOL><DEDENT>else:<EOL><INDENT>result['<STR_LIT>'] = <NUM_LIT:0><EOL><DEDENT>if self._learningFieldIndex is not None:<EOL><INDENT>result['<STR_LIT>'] = int(bool(inputRow[self._learningFieldIndex]))<EOL><DEDENT>result['<STR_LIT>'] = None<EOL>if self._timestampFieldIndex is not None:<EOL><INDENT>result['<STR_LIT>'] = inputRow[self._timestampFieldIndex]<EOL>result['<STR_LIT>'] = self._computeTimestampRecordIdx(<EOL>inputRow[self._timestampFieldIndex])<EOL><DEDENT>else:<EOL><INDENT>result['<STR_LIT>'] = None<EOL><DEDENT>hasReset = self._resetFieldIndex is not None<EOL>hasSequenceId = self._sequenceFieldIndex is not None<EOL>if hasReset and not hasSequenceId:<EOL><INDENT>if result['<STR_LIT>']:<EOL><INDENT>self._sequenceId += <NUM_LIT:1><EOL><DEDENT>sequenceId = self._sequenceId<EOL><DEDENT>elif not hasReset and hasSequenceId:<EOL><INDENT>sequenceId = inputRow[self._sequenceFieldIndex]<EOL>result['<STR_LIT>'] = int(sequenceId != self._sequenceId)<EOL>self._sequenceId = sequenceId<EOL><DEDENT>elif hasReset and hasSequenceId:<EOL><INDENT>sequenceId = inputRow[self._sequenceFieldIndex]<EOL><DEDENT>else:<EOL><INDENT>sequenceId = <NUM_LIT:0><EOL><DEDENT>if sequenceId is not None:<EOL><INDENT>result['<STR_LIT>'] = hash(sequenceId)<EOL><DEDENT>else:<EOL><INDENT>result['<STR_LIT>'] = None<EOL><DEDENT>return result<EOL>
Encodes the given input row as a dict, with the
        keys being the field names. This also adds in some meta fields:
          '_category': The value from the category field (if any)
          '_reset': True if the reset field was True (if any)
          '_sequenceId': the value from the sequenceId field (if any)

        :param inputRow: sequence of values corresponding to a single input metric
          data row
        :rtype: dict