Exemplo n.º 1
0
  def __init__(self, inferenceType=InferenceType.TemporalNextStep,
               encoderParams=()):
    super(TwoGramModel, self).__init__(inferenceType)

    self._logger = opf_utils.initLogger(self)
    self._reset = False
    self._hashToValueDict = dict()
    self._learningEnabled = True
    self._encoder = encoders.MultiEncoder(encoderParams)
    self._fieldNames = self._encoder.getScalarNames()
    self._prevValues = [] * len(self._fieldNames)
    self._twoGramDicts = [dict() for _ in xrange(len(self._fieldNames))]
Exemplo n.º 2
0
  def __init__(self, inferenceType=InferenceType.TemporalNextStep,
               encoderParams=()):
    """ Two-gram model constructor.

    inferenceType: An opf_utils.InferenceType value that specifies what type of
        inference (i.e. TemporalNextStep, Classification, etc.)
    encoders: Sequence of encoder params dictionaries.
    """
    super(TwoGramModel, self).__init__(inferenceType)

    self._logger = opf_utils.initLogger(self)
    self._reset = False
    self._hashToValueDict = dict()
    self._learningEnabled = True
    self._encoder = encoders.MultiEncoder(encoderParams)
    self._fieldNames = self._encoder.getScalarNames()
    self._prevValues = [None] * len(self._fieldNames)
    self._twoGramDicts = [dict() for _ in xrange(len(self._fieldNames))]