Ejemplo n.º 1
0
 def predict(self, entity, fields=None):
     panda = self.pandas[0]
     score = panda.predict(entity)
     if sign0(score) > 0:
         self.tigress.measure(entity, panda.name)
         monitor_accuracy(panda.name, self.creator, score, 'True')
         return panda.name
     else:
         self.tigress.measure(entity, cons.DEFAULT_NONE)
         monitor_accuracy(panda.name, self.creator, score, 'False')
         return cons.DEFAULT_NONE
Ejemplo n.º 2
0
 def predict(self, entity, fields=None):
     panda = self.pandas[0]
     score = panda.predict(entity)
     if sign0(score) > 0:
         self.tigress.measure(entity, panda.name)
         monitor_accuracy(panda.name, self.creator, score, 'True')
         return panda.name
     else:
         self.tigress.measure(entity, cons.DEFAULT_NONE)
         monitor_accuracy(panda.name, self.creator, score, 'False')
         return cons.DEFAULT_NONE
Ejemplo n.º 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]
Ejemplo n.º 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]
Ejemplo n.º 5
0
	[ent.save() for ent in ents]
	likeTS = ms.yaml2json('turtle_scripts/turtle_like.yml')
	# print likeTS
	likeT = ms.create_turtle(likeTS)
	likeT.save()
	ent = ents[0]
	# print ents[0].generic()
	ent._setattr('likeTravel', 'Y')
	ms.crane.entityStore.save_one(ent)
	ms.add_data('likeTravel', 'monk', str(ents[0]._id))
	print likeT.tigress.p
	print likeT.pandas[0].mantis.data
	likeT.tigress.defaulting=True
	likeT.save()
	likeT = ms.load_turtle('likeTravel','monk')
	likeT.train()
	for i in ents:
		ent = ms.load_entity(i._id)
		print likeT.pandas[0].predict(ent)
		print sign0(likeT.pandas[0].predict(ent))
	# likeTS = ms.yaml2json('turtle_scripts/turtle_like.yml')
	# # print likeTS
	# likeT = ms.create_turtle(likeTS)
	# likeT.save()

	# ent = ents[0]
	# # print ents[0].generic()

	# ent._setattr('likeTravel', 'Y')
	# ms.crane.entityStore.save_all(ents)
	# print ent.generic()