Пример #1
0
class AbstractMLStrategy(AbstractStrategy):
    """
    Implementation of AbstractStrategy using a given machine learning model
    """
    def __init__(self, model, version=0):
        super(AbstractStrategy, self).__init__()
        self._detector_ie = InferenceEngine(model, version=version)
        self._version = version

    # overridden
    def should_accuse_non_trivially(self, prev_turns):
        classifier_data = {'val': prev_turns[-1][1]}
        if self._version == 1:
            classifier_data['position'] = len(prev_turns) + 1
        if len(prev_turns) > 1:
            classifier_data['val_pre'] = prev_turns[-2][1]

        accuse = self._detector_ie.inference(classifier_data)
        return accuse
Пример #2
0
 def __init__(self, old_strategy, model, version=0):
     super(AbstractMLStrategy, self).__init__()
     self._detector_ie = InferenceEngine(model, version=version)
     self._version = version
     self.old_strategy = old_strategy