def _clack_words(self): if self._learning_words: sight_pattern = self.s_knowledge_in.get_pattern() sight_class = "None" sight_knowledge = RbfKnowledge(sight_pattern, sight_class) self.words_net.clack(sight_knowledge) CulturalNetwork.serialize(self.words_net, "persistent_memory/words_net.p") self._learning_words = False else: hearing_pattern = self.h_knowledge_in.get_pattern() hearing_class = self.h_knowledge_in.get_class() hearing_knowledge = RbfKnowledge(hearing_pattern, hearing_class) self.syllables_net.clack(hearing_knowledge) CulturalNetwork.serialize(self.syllables_net, "persistent_memory/syllables_net.p") syll_hearing_id = self.syllables_net.get_last_clack_id() sight_pattern = self.s_knowledge_in.get_pattern() # Recognize if self.snb.recognize_sight(sight_pattern) == "HIT": sight_id = self.snb.snb_s.get_rneurons_ids()[0] else: sight_class = "syll_" + str(syll_hearing_id) sight_knowledge = RbfKnowledge(sight_pattern, sight_class) self.snb.learn_sight(sight_knowledge) sight_id = self.snb.snb_s.get_last_learned_id() self.snb.save("persistent_memory/sight_snb.p", "persistent_memory/hearing_snb.p") # Learn relation in new net rel_knowledge = RelKnowledge(syll_hearing_id, sight_id) self.ss_rnb.learn(rel_knowledge) RelNetwork.serialize(self.ss_rnb, "persistent_memory/ss_rnb.p") self._learning_syllables = False
def _clack_addition(self): s_pattern = self.s_knowledge_in.get_pattern() self.state = self.snb.recognize_sight(s_pattern) if self.state == "HIT": hearing_id = self._get_hearing_id_recognize() self.am_net.clack(hearing_id) CulturalNetwork.serialize(self.am_net, "persistent_memory/am_net.p")
def erase_all_knowledge(self): # snb self.snb = SensoryNeuralBlock() self.snb.save("persistent_memory/sight_snb.p", "persistent_memory/hearing_snb.p") # Relational Neural Block self.rnb = RelNetwork(100) RelNetwork.serialize(self.rnb, "persistent_memory/rnb.p") # Addition by memory network self.am_net = CulturalNetwork(100) CulturalNetwork.serialize(self.am_net, "persistent_memory/am_net.p") # Syllables net self.syllables_net = CulturalNetwork(100) CulturalNetwork.serialize(self.syllables_net, "persistent_memory/syllables_net.p") # Words net self.words_net = CulturalNetwork(100) CulturalNetwork.serialize(self.words_net, "persistent_memory/words_net.p") # Sight-Syllables rel network self.ss_rnb = RelNetwork(100) RelNetwork.serialize(self.ss_rnb, "persistent_memory/ss_rnb.p") # Geometric Neural Block self.gnb = GeometricNeuralBlock() GeometricNeuralBlock.serialize(self.gnb, "persistent_memory/gnb.p") ################ INTENTIONS #################################################################################### self.episodic_memory = EpisodicMemoriesBlock() EpisodicMemoriesBlock.serialize(self.episodic_memory, "persistent_memory/episodic_memory.p") self.decisions_block = DecisionsBlock() DecisionsBlock.serialize(self.decisions_block, "persistent_memory/decisions_block.p") self.internal_state = InternalState() InternalState.serialize(self.internal_state, "persistent_memory/internal_state.p") self.desired_state = InternalState([0.5,1,1]) InternalState.serialize(self.desired_state, "persistent_memory/desired_state.p")
def create_kernel(self): # snb self.snb = SensoryNeuralBlock("no_data", "no_data", self.project_id) self.snb.save("snb_s", "snb_h", self.project_id, self.brain) # Relational Neural Block self.rnb = RelNetwork(100) RelNetwork.serialize(self.rnb, "rnb", self.project_id) # Addition by memory network self.am_net = CulturalNetwork(100) CulturalNetwork.serialize(self.am_net, "am_net", self.project_id) # Syllables net self.syllables_net = CulturalNetwork(100) CulturalNetwork.serialize(self.syllables_net, "syllables_net", self.project_id) # Words net self.words_net = CulturalNetwork(100) CulturalNetwork.serialize(self.words_net, "words_net", self.project_id) # Sight-Syllables rel network self.ss_rnb = RelNetwork(100) RelNetwork.serialize(self.ss_rnb, "ss_rnb", self.project_id) # Geometric Neural Block self.gnb = GeometricNeuralBlock() GeometricNeuralBlock.serialize(self.gnb, "gnb", self.project_id) ################ INTENTIONS #################################################################################### self.episodic_memory = EpisodicMemoriesBlock() EpisodicMemoriesBlock.serialize(self.episodic_memory, "episodic_memory", self.project_id) self.decisions_block = DecisionsBlock() DecisionsBlock.serialize(self.decisions_block, "decisions_block", self.project_id) self.internal_state = InternalState() InternalState.serialize(self.internal_state, "internal_state", self.project_id) self.desired_state = InternalState([0.75, 0.75, 0.75]) InternalState.serialize(self.desired_state, "desired_state", self.project_id)