def get_activated_node(self): """returns the node with the highest activation """ activations = [] for i in self.nodes: activations.append(i.activation) return self.nodes[auks.posMax(activations)]
def get_closest_concept_tagsim(self, object_data): """ returns the tag and similarity of the closest concept to the given stimulus """ similarities = [] for i in self.concepts: similarities.append(auks.calculate_similarity(object_data, i.get_data(), cfg.sensitivity)) max_pos = auks.posMax(similarities) return (self.concepts[max_pos].tag, similarities[max_pos])
def get_h_tag(self, v_tag): """ retrieves the h_tag with the highest association for the given v_tag if there are more than one h_tags with the highest association value, the first one will be returned """ v_index = -1 for count, i in enumerate(self.vertical_tags): if i == v_tag: v_index = count break if v_index == -1: return "label_unknown" else: max = auks.posMax(self.matrix[v_index]) return self.horizontal_tags[max]
def get_v_tag(self, h_tag, inaccuracy=None): """ retrieves the v_tag with the highest association for the given h_tag if there are more than one v_tags with the highest association value, the first one will be returned if inaccuracy == True/1, the v_tag with the 2nd highest association is returned """ h_index = -1 for count, i in enumerate(self.horizontal_tags): if i == h_tag: h_index = count break if h_index == -1: return "tag_unknown" else: value_list = [] for i in self.matrix: for count, j in enumerate(i): if count == h_index: value_list.append(j) if inaccuracy: return self.vertical_tags[auks.posSemiMax(value_list)] else: return self.vertical_tags[auks.posMax(value_list)]