本文整理汇总了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)
示例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