当前位置: 首页>>代码示例>>Python>>正文


Python Agent.evaluate方法代码示例

本文整理汇总了Python中agent.Agent.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.evaluate方法的具体用法?Python Agent.evaluate怎么用?Python Agent.evaluate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在agent.Agent的用法示例。


在下文中一共展示了Agent.evaluate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: evaluate

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import evaluate [as 别名]
def evaluate(agent_id, inputs):
    """Make a fuzzy controller evaluation and return the results.

    Arguments:

    agent_id -- the Agent to call
    inputs -- dictionary of input values to send

    Returns the results as a dictionary.
    """
    agent = Agent(agent_id)
    return agent.evaluate(inputs)
开发者ID:tofficer,项目名称:python,代码行数:14,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import evaluate [as 别名]

#.........这里部分代码省略.........
        print 'started!'
        return self.agent.start()

    
    def present_word(self, now):
        '''
        '''
        time_delta = now-self.start_time
        print time_delta, ': PRESENT WORD', time_delta.seconds
        
        if self.has_next():
            word = self.pairs[self.index].word
            number = self.pairs[self.index].number
            
            self.logger.log('\nTask [{0} : {1}] @ {2}s'.format(
                            word.word, number.word, time_delta))
            
            self.pairs[self.index].word_called(utilities.milliseconds(now))
            self.start_time_answer = now
            self.answer_given = False

            return self.agent.present_word(word, number)
        else:
            print 'Index Error'

    def present_number(self, now):
        '''
        '''
        time_delta = now-self.start_time
        print time_delta, ': PRESENT NR', time_delta.seconds
        # Check if answer has been given. If not evaluate.
        if not self.answer_given:
            self.logger.log('  No answer given')
            self.evaluate('-1', now)        
        
        if 0 <= self.index and self.index <= len(self.pairs):
            number = self.pairs[self.index].number
            self.pairs[self.index].number_called(utilities.milliseconds(now))
            self.index += 1

            return self.agent.present_number(number)
        else:
            print 'Index Error'


    def evaluate(self, received, now):
        ''' 
        '''
        time_delta = now-self.start_time
        print time_delta, 'EVALUATE', now-self.start_time_answer
        self.answer_given = True
        
        correct = 0
        if received == self.pairs[self.index].number.word:
            correct = 1
        elif received == '-1':
            correct = 2
                
        word = self.pairs[self.index].word
        number = self.pairs[self.index].number
        emotion, cog, speech = self.agent.evaluate(correct)

        # ADD OR ADD NOT??
        #word.add(now)
        log_correct = {0:0, 1:1, 2:0}[correct]
        time = now - self.start_time_answer
开发者ID:philipstahl,项目名称:emotutor,代码行数:70,代码来源:environment.py


注:本文中的agent.Agent.evaluate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。