def get_closest_concept_tagdist(self, object_data): """ returns the tag and distance of the closest concept to the given stimulus """ similarities = [] for i in self.concepts: similarities.append(auks.calculate_distance(object_data, i.get_data())) max_min = auks.posMin(similarities) return (self.concepts[max_min].tag, similarities[max_min])
def get_closest_concept_tag(self, object_data): """ returns the tag of the closest concept based on given stimulus """ similarities = [] for i in self.concepts: #similarities.append(auks.calculate_similarity(object_data, i.get_data(), cfg.sensitivity)) # not using similarity but distance at the moment, possibly change similarities.append(auks.calculate_distance(object_data, i.get_data())) return self.concepts[auks.posMin(similarities)].tag
def get_closest_concept_tags_domains(self, object_data): """ returns the tag of the closest concept based on given stimulus, one tag for each domain in the object_data """ domain_tags = [] for j in object_data: similarities = [] for i in self.concepts: #similarities.append(auks.calculate_similarity(object_data, i.get_data(), cfg.sensitivity)) # not using similarity but distance at the moment, possibly change similarities.append(auks.calculate_distance([j], i.get_data())) domain_tags.append(self.concepts[auks.posMin(similarities)].tag) return domain_tags
def answer_gg(self, words, context): """ Guessing game answer. Agent uses the incoming word labels and the associated concept to identify the topic from the context, the presumed topic index is communicated to the other agent. """ percept = self.get_percept(words) if percept == "no_known_words": return percept else: context_distances = [] for i in context: distance = auks.calculate_distance(i, percept.get_data()) context_distances.append(distance) return [auks.posMin(context_distances), percept.tag]