Example #1
0
 def add_data(self, entity):
     targetId = entity.get_raw(self.RAW_TARGETID, None)
     relevance = entity.get_raw(self.RAW_RELEVANCE, 0)
     if targetId:
         target = self.targetStore.load_one_by_id(targetId)
         relation = MatchingRelation()
         relation.set_argument(0, entity)
         relation.set_argument(1, target)
         relation.compute()
         relation.set_raw(self.RAW_RELEVANCE, relevance)
         self.tigress.supervise(self, relation)
Example #2
0
 def add_data(self, entity):
     targetId = entity.get_raw(self.RAW_TARGETID, None)
     relevance = entity.get_raw(self.RAW_RELEVANCE, 0)
     if targetId:
         target = self.targetStore.load_one_by_id(targetId)
         relation = MatchingRelation()
         relation.set_argument(0, entity)
         relation.set_argument(1, target)
         relation.compute()
         relation.set_raw(self.RAW_RELEVANCE, relevance)
         self.tigress.supervise(self, relation)
Example #3
0
 def predict(self, entity, fields=None):
     query = eval(self.queryFunc)(entity)
     targetIds = self.targetStore.load_all_in_ids(query, 0, self.windowSize)
     targets = self.targetStore.load_all_by_ids(targetIds)
     relation = MatchingRelation()
     relation.set_argument(0, entity)
     results = []
     for target in targets:
         relation.set_argument(1, target)
         relation.compute()
         rank = self.invertedMapping[[
             sign0(panda.predict(relation)) for panda in self.pandas
         ]]
         results.append((rank, target))
     results.sort(reverse=True)
     return results[:self.beamSize]
Example #4
0
 def predict(self, entity, fields=None):
     query = eval(self.queryFunc)(entity)
     targetIds = self.targetStore.load_all_in_ids(query, 0, self.windowSize)
     targets = self.targetStore.load_all_by_ids(targetIds)
     relation = MatchingRelation()
     relation.set_argument(0, entity)
     results = []
     for target in targets:
         relation.set_argument(1, target)
         relation.compute()
         rank = self.invertedMapping[[sign0(panda.predict(relation)) for panda in self.pandas]]
         results.append((rank, target))
     results.sort(reverse=True)
     return results[:self.beamSize]